From 0fc963122cbcfb92553ba8c8d8b584cdaa486538 Mon Sep 17 00:00:00 2001 From: Mazet Laurent Date: Fri, 13 Jun 2025 19:07:22 +0200 Subject: [PATCH] update makefile --- makefile | 24 ++++++++++++++++++++---- mapec.c | 2 ++ ulvpn.c | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index af2f212..ec39cae 100644 --- a/makefile +++ b/makefile @@ -6,7 +6,6 @@ CC ?= gcc RANLIB ?= ranlib #INCLUDES = -I../debug -D__MEMORY_ALLOCATION__ -INCLUDES = -D_DEFAULT_SOURCE=1 INCLUDES += -DVERBOSE_COLOR=1 #INCLUDES += -DVERBOSE_LOCATION=1 OFLAGS = -O4 -Os @@ -79,6 +78,9 @@ VALID = $(call TITLE, $(1)) && $(2) && $(call PASS, SUCCESS) || { $(call FAIL, F GETCOMMENTS = awk '/\/\*[ \t]*$(1):/,/\*\// { sub(/.*\/\*[ \t]*$(1):/, ""); sub (/[ \t]*\*\/.*/, ""); print } /\/\/[ \t]*$(1):/ {sub (/.*\/\/[ \t]*$(1):/, ""); print }' $(2) #GETCOMMENTS = perl -- getcomments.pl -p='$(1):\s' -f='%' $(2) +DATE = $(shell git log -1 HEAD --format=%ai|awk '{print $$1}') +#DATE = $(shell hg log -r-1 --template '{date|isodate}'|awk '{print $$1}') + ## Generic rules all: depends @@ -95,10 +97,10 @@ count: clean: $(call TITLE, "Cleaning") touch clean - rm -f clean $(wildcard *.d *.ld *.log *.o *.test *~ .exec_* gmon.out _) + 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)) +depends: $(patsubst %.c, %.d, $(wildcard *.c)) $(patsubst %, %.ld, $(ALLEXE)) $(patsubst %, %.lld, $(ALLDLL)) documentation: doxygen.conf $(shell awk '{sub(/#.*/,"")} /^FILE_PATTERNS/,!/\\$$/ {sub(/\\$$/,"");sub(/.*=/,"");print}' doxygen.conf) doxygen $<; true @@ -135,10 +137,14 @@ tests: $(MAKE) all $(MAKE) $(addprefix test_,$(ALLEXE)) +archive: wipe changelog documentation + name=`basename "$$(pwd)"`; cd ..; tar cvz --exclude='.git*' -f $$name-$(DATE).tgz $$name + ## Main rules include $(wildcard *.d) include $(wildcard *.ld) +include $(wildcard *.lld) gcov_%: $(MAKE) purge @@ -197,6 +203,11 @@ valgrind_%: %.exe $(MV) $@~ $@ $(call PASS, SUCCESS) +lib%.lld: %.c + $(call TITLE, "Building $@") + echo ${@:.lld=.a}: $(shell $(call GETCOMMENTS,$(AROPT), $<) | awk '{for (i=1;i<=NF;i++) if ($$(i) ~ /.o$$/) printf " %s", $$(i)}') > $@ + $(call PASS, SUCCESS) + %.ld: %.c $(call TITLE, "Building $@") echo ${<:.c=.exe}: $(shell $(call GETCOMMENTS,$(LDOPT), $<) | awk '{for (i=1;i<=NF;i++) if ($$(i) ~ /.o$$/) printf " %s", $$(i)}') > $@ @@ -239,9 +250,14 @@ install_lib: install_exe: make $(addprefix install_,$(ALLEXE)) +changelog: + echo "Logs from $(DATE)" > $@.txt + git log --pretty=format:'- %s' >> $@.txt +# hg log --template changelog >>$@.txt + ## Phony -.PHONY: all analyze clean count depends documentation gcovs purge tests +.PHONY: all analyze changelog clean count depends documentation gcovs purge tests ## Precious diff --git a/mapec.c b/mapec.c index 1cb8754..bad6dfa 100644 --- a/mapec.c +++ b/mapec.c @@ -12,6 +12,8 @@ - initial version */ +#define _DEFAULT_SOURCE = 1 + #include #include #include diff --git a/ulvpn.c b/ulvpn.c index 6215341..3e52908 100644 --- a/ulvpn.c +++ b/ulvpn.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include -- 2.30.2