From: Mazet Laurent Date: Fri, 20 Jun 2025 06:49:36 +0000 (+0200) Subject: omni-makefile X-Git-Tag: v1.0~4 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=794e1fce6c48411829d0272c75b209693b8f1af8;p=morep.git omni-makefile --- diff --git a/.gitignore b/.gitignore index 2b71b23..435e061 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,23 @@ *.ld *.lld *.o + *.exe *.a + +*.gcda +*.gcno +*.gcov +*.glog +*.log +*.test + +*~ +*.bak + +.exec_* +gmon.out + +.depends +documentation +changelog.txt diff --git a/makefile b/makefile index 873bd42..85e3b4d 100644 --- a/makefile +++ b/makefile @@ -84,7 +84,8 @@ DATE = $(shell git log -1 HEAD --format=%ai|awk '{print $$1}') ## Generic rules all: depends - [ "$(ALLEXE)" ] || { $(call FAIL,no exec to proceed); test; } && $(MAKE) $(ALLEXE:%=%.exe) + [ -z "$(ALLEXE)" ] || $(MAKE) $(ALLEXE:%=%.exe) + [ -z "$(ALLDLL)" ] || $(MAKE) $(ALLDLL:%=%.a) analyze: make purge @@ -100,13 +101,21 @@ clean: rm -f clean $(wildcard *.d *.ld *.lld *.log *.o *.test *~ .exec_* gmon.out _) $(call PASS, SUCCESS) -depends: $(patsubst %.c, %.d, $(wildcard *.c)) $(patsubst %, %.ld, $(ALLEXE)) $(patsubst %, %.lld, $(ALLDLL)) +depends: .depends $(patsubst %.c, %.d, $(wildcard *.c)) $(patsubst %, %.ld, $(ALLEXE)) $(patsubst %, %.lld, $(ALLDLL)) + +.depends: + [ "$(ALLEXE)" ] || $(call WARN,no exec to proceed) + [ "$(ALLDLL)" ] || $(call WARN,no library to proceed) + touch $@ -documentation: doxygen.conf $(shell awk '{sub(/#.*/,"")} /^FILE_PATTERNS/,!/\\$$/ {sub(/\\$$/,"");sub(/.*=/,"");print}' doxygen.conf) +documentation: doxygen.conf $(shell test -f doxygen.conf && awk '{sub(/#.*/,"")} /^FILE_PATTERNS/,!/\\$$/ {sub(/\\$$/,"");sub(/.*=/,"");print}' doxygen.conf) doxygen $<; true sed -i s/__BEGIN_DECLS//g documentation/html/*.html sed -i s/\\_\\-\\_BEGIN\\_\\-DECLS//g documentation/latex/*.tex +exe: depends + [ "$(ALLEXE)" ] || { $(call FAIL,no exec to proceed); test; } && $(MAKE) $(ALLEXE:%=%.exe) + gcovs: wipe $(MAKE) $(addprefix gcov_,$(ALLEXE)) @@ -119,7 +128,7 @@ lib: depends purge: clean $(call TITLE, "Purging") touch purge - rm -f purge $(ALLEXE:%=%.exe) $(ALLDLL:%=%.a) + rm -f purge $(wildcard .depends) $(ALLEXE:%=%.exe) $(ALLDLL:%=%.a) $(call PASS, SUCCESS) valgrinds: @@ -137,7 +146,8 @@ tests: $(MAKE) all $(MAKE) $(addprefix test_,$(ALLEXE)) -archive: wipe changelog documentation +archive: wipe changelog + [ \! -f doxygen.conf ] || make documentation name=`basename "$$(pwd)"`; cd ..; tar cvz --exclude='.git*' -f $$name-$(DATE).tgz $$name ## Main rules @@ -257,7 +267,7 @@ changelog: ## Phony -.PHONY: all analyze changelog clean count depends documentation gcovs purge tests +.PHONY: all analyze archive changelog clean count depends documentation exe gcovs gprofs install_lib install_exe lib purge tests valgrinds wipe ## Precious