From: Mazet Laurent Date: Fri, 20 Jun 2025 06:49:44 +0000 (+0200) Subject: omni-makefile X-Git-Tag: v1.0~5 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=d18112bf223ec5195c074a9b90b112392b9f956c;p=ulvpn.git omni-makefile --- diff --git a/.gitignore b/.gitignore index c6775da..435e061 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,24 @@ *.d *.ld +*.lld *.o + *.exe *.a + +*.gcda +*.gcno +*.gcov +*.glog +*.log +*.test + +*~ +*.bak + +.exec_* +gmon.out + +.depends +documentation +changelog.txt diff --git a/doxygen.conf b/doxygen.conf index cb87af0..0138bce 100644 --- a/doxygen.conf +++ b/doxygen.conf @@ -925,10 +925,9 @@ INPUT_ENCODING = UTF-8 # comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, # *.vhdl, *.ucf, *.qsf and *.ice. -FILE_PATTERNS = morep.c \ - morep.h \ - parse.h \ - pdu_*.h +FILE_PATTERNS = mapec.c \ + mapec.h \ + ulvpn.c # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. diff --git a/makefile b/makefile index ec39cae..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 @@ -150,7 +160,7 @@ gcov_%: $(MAKE) purge $(MAKE) depends OPTIONS="-coverage -O0" $(MAKE) ${@:gcov_%=%}.exe - umask 000; $(MAKE) test_$(@:gcov_%=%) + $(MAKE) test_$(@:gcov_%=%) gcov `sed -e 's/\.exe:/.c/;s/\.o/.c/g;s/ -l[^ ]*//g' $(@:gcov_%=%.ld)` $(MAKE) purge grep '^ *#####' *.c.gcov || true @@ -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