update makefile
authorMazet Laurent <laurent.mazet@thalesgroup.com>
Fri, 13 Jun 2025 17:07:22 +0000 (19:07 +0200)
committerMazet Laurent <laurent.mazet@thalesgroup.com>
Fri, 13 Jun 2025 17:07:22 +0000 (19:07 +0200)
makefile
mapec.c
ulvpn.c

index af2f212a75f930dc34604e460c37088d47c15fb8..ec39cae8872eb27569a6d98e2f4df380764df636 100644 (file)
--- 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 1cb875404ffade1cb0c7758ff385bbc77dc30c5d..bad6dfa79ca4ea5e08d30a627f34e6b07209ab4e 100644 (file)
--- a/mapec.c
+++ b/mapec.c
@@ -12,6 +12,8 @@
   - initial version
 */
 
+#define _DEFAULT_SOURCE = 1
+
 #include <arpa/inet.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/ulvpn.c b/ulvpn.c
index 62153419433926db644ae9ce1b5baef302758f93..3e52908fc1dcb6f5ec2b253952f921717cb9f03d 100644 (file)
--- a/ulvpn.c
+++ b/ulvpn.c
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/select.h>
 
 #include <morep/morep.h>
 #include <morep/pdu_clear_data.h>