* including build script
* new options
* including pre/post installation scripts
+ * packing for tgz and versioning
-- Michael Wagner <michael@wagnertech.de> Fr 10. Aug 22:54:48 CEST 2018
projects (0.1-%BUILD%) unstable; urgency=medium
--- /dev/null
+Source: projects
+Section: main
+Priority: optional
+Maintainer: Michael Wagner <michael@wagnertech.de>
+Build-Depends: git
+
+Package: mbuild
+Architecture: all
+Depends: dpkg-dev
+Description: WagnerTech build environment
+ Simple build environment for Debian packages
+ .
+ This package contains scripts and makefiles for
+ script and C/C++ packages.
mkdir -p $base/usr/share/mbuild/
cp tools/make/rules $base/usr/share/mbuild/
cp tools/make/insert_build.sh $base/usr/share/mbuild/
+cp tools/make/mMakefile $base/usr/share/mbuild/makefile
mkdir -p $base/usr/share/man/man8
gzip -c doc/mbuild.8 >$base/usr/share/man/man8/mbuild.8.gz
--- /dev/null
+# Generic makefile for mBuild build process
+
+
+# default parameters
+CC = g++
+INSERT_BUILD = /usr/share/mbuild/insert_build.sh
+
+include make.pre
+
+# All Target
+all: $(DEPS) $(SOURCE:%.cpp=%.o) $(TARGET)
+
+# Other Targets
+clean:
+ -rm *.o
+ -rm $(TARGET)
+
+
+.PHONY: all make.post
+
+%.a: $(SOURCE:%.cpp=%.o)
+ ar r $(TARGET) *.o
+
+%.so: $(SOURCE:%.cpp=%.o) $(LDLIBS)
+ $(CXX) -shared -o $(TARGET) *.o $(LDLIBS) $(EXTLIB)
+
+make.pre: ~/build/debian/rules.pre
+ cp ~/build/debian/rules.pre make.pre
+
+-include make.post
+# defile default operations
+
+#-----------------------------------------------------------------
+# Build-Regeln
+#-----------------------------------------------------------------
+%.pdf : %.tex $(SOURCES)
+ pdflatex $< && pdflatex $<
+ cp $*.pdf ~/build
+
# Generic makefile for mBuild build process
+# defile default operations
+
+NOP = @echo "No operation for target $@"
+COMPILE = $(NOP)
+COMPILE_TARGET = compile.stamp
+COPY = $(NOP)
+ZIP = zip -r $(project).zip $(project)
+DEB = fakeroot dpkg-deb --build $(project)
+INSERT_BUILD = projects/tools/make/insert_build.sh
-# default parameters
-CC = g++
-INSERT_BUILD = /usr/share/mbuild/insert_build.sh
+#default parameters
+project = default
+SOURCES =
+COPY_PRE =
+# Load project specification
include make.pre
-# All Target
-all: $(DEPS) $(SOURCE:%.cpp=%.o) $(TARGET)
+.SUFFIXES: .stamp .zip
-# Other Targets
-clean:
- -rm *.o
- -rm $(TARGET)
+#-----------------------------------------------------------------
+# Hauptziele:
+#
+# : ohne Parameter wird compiliert
+# - zip : packt ZIP file
+# - deb : packt Debian package
+#
+#-----------------------------------------------------------------
+
+compile: $(COMPILE_TARGET)
+ # compile ist fertig
-.PHONY: all make.post
+zip: $(project).zip
+ # ZIP file ready
-%.a: $(SOURCE:%.cpp=%.o)
- ar r $(TARGET) *.o
+deb: $(project).deb
+ # Debian package ready
-%.so: $(SOURCE:%.cpp=%.o) $(LDLIBS)
- $(CXX) -shared -o $(TARGET) *.o $(LDLIBS) $(EXTLIB)
+version: $(COMPILE_TARGET)
+ $(INSERT_BUILD) $(COMPILE_TARGET) $(build)
-make.pre: ~/build/debian/rules.pre
- cp ~/build/debian/rules.pre make.pre
+#-----------------------------------------------------------------
+# compile steps
+#-----------------------------------------------------------------
+compile.stamp: $(SOURCES)
+ $(COMPILE)
+ @touch compile.stamp
--include make.post
-# defile default operations
+#-----------------------------------------------------------------
+# pack steps
+#-----------------------------------------------------------------
+
+copy.stamp: $(COPY_PRE)
+ $(COPY) $(project) $(version) ${arch}
+ @touch copy.stamp
+
+control.stamp: $(project).control
+ mkdir -p $(project)/DEBIAN
+ cp $(project).control $(project)/DEBIAN/control
+ if [ -f $(project).preinst ]; then cp $(project).preinst $(project)/DEBIAN/preinst; fi
+ if [ -f $(project).postinst ]; then cp $(project).postinst $(project)/DEBIAN/postinst; fi
+ if [ -f $(project).prerm ]; then cp $(project).prerm $(project)/DEBIAN/prerm; fi
+ if [ -f $(project).postrm ]; then cp $(project).postrm $(project)/DEBIAN/postrm; fi
+ @touch control.stamp
+
+$(project).zip: copy.stamp $(project)
+ $(ZIP)
+
+$(project).deb: copy.stamp control.stamp
+ $(DEB)
+ cp $(project).deb $(project)_$(version)$(_arch).deb
+
+#-----------------------------------------------------------------
+# utilities
+#-----------------------------------------------------------------
+clean:
+ -rm *.stamp 2>/dev/null
+ if [ -e $(project).zip ]; then rm $(project).zip; fi
+ if [ -e $(project) ]; then rm -rf $(project); fi
#-----------------------------------------------------------------
# Build-Regeln
%.pdf : %.tex $(SOURCES)
pdflatex $< && pdflatex $<
+
rm -rf ../build
mkdir ../build
fi
- debian/$paket.build -prepare
+ if grep -- "-prepare" debian/$paket.build >/dev/null
+ then
+ debian/rules sync
+ debian/$paket.build -prepare
+ fi
fi
# pack prepare
- if [ -f debian/$paket.cp -a -f $paket.control ]
+ if [ -f debian/$paket.cp -a -f debian/$paket.control ]
then
echo "PACK=binary" >> debian/rules.pre
elif [ -f debian/$paket.cp ]
fi
fi
-if [ $compile -eq 1 -a ! -e debian/build.sh ]
+if [ $compile -eq 1 -a ! -e debian/$paket.build ]
then
echo "no debian/build.sh: skipping build step"
compile=0
# defile default operations
NOP = @echo "No operation for target $@"
DEB = fakeroot dpkg-deb --build debian/tmp
+INSERT_BUILD = /usr/share/mbuild/insert_build.sh
include debian/rules.pre
# Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis
binary-indep: copy ../$(paket)_$(version)-$(build)$(_arch).deb
-version: $(TARGET)
- $(INSERT_BUILD) $(TARGET) $(build)
+version: ~/build/$(TARGET)
+ $(INSERT_BUILD) ~/build/$(TARGET) $(build)
+ cp ~/build/*$(build)* ../
../build:
mkdir ../build
debian/tmp/DEBIAN/control: debian/control debian/changelog
dpkg-gencontrol
-debian/changelog: debian/$(paket).changelog debian/setenv.sh
+debian/changelog: debian/$(paket).changelog debian/rules.pre
sed "s/%BUILD%/$(build)/" debian/$(paket).changelog > debian/changelog
# echo "${pwd} (${build}) unstable; urgency=medium" > debian/changelog
# echo " * generated by mbuild" >> debian/changelog