X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/projects.git/blobdiff_plain/160d72dfc4b7fbcd9f075fe71fd607e43c7b48c7..ff2607419be96666a6e4eff72a86a5341335d216:/tools/make/makefile diff --git a/tools/make/makefile b/tools/make/makefile index 9ade437..1bee6f4 100644 --- a/tools/make/makefile +++ b/tools/make/makefile @@ -1,34 +1,85 @@ # 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 @@ -36,3 +87,4 @@ make.pre: ~/build/debian/rules.pre %.pdf : %.tex $(SOURCES) pdflatex $< && pdflatex $< +