From 764ba227cc4a07d4e40bc4a930459ab14078c43d Mon Sep 17 00:00:00 2001 From: M.Gergő Date: Tue, 26 May 2020 20:02:32 +0200 Subject: makefile + gcc preprocessor --- makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index 836ec59..c73a803 100644 --- a/makefile +++ b/makefile @@ -11,9 +11,10 @@ RM = -/bin/rm CP = -/bin/cp # fordíto általános flagek -LASTVER = $(shell git describe --tags) -LASTMAIN = $(firstword $(subst ., ,$(LASTVER))) -CFLAGS = -Wall -c -D"GIT_VERSION=$(LASTVER)" -D"GIT_MAINVERSION=$(LASTMAIN)" +LASTVER = $(shell git describe) +LASTVERT = $(shell git describe --tags --abbrev=0) +LASTMAINT = $(firstword $(subst ., ,$(LASTVERT))) +CFLAGS = -Wall -c -D"GIT_LAST=$(LASTVER)" -D"GIT_LASTT=$(LASTVERT)" -D"GIT_MAINT=$(LASTMAINT)" LDFLAGS = LDLIBS = @@ -42,15 +43,15 @@ test: $(PROG) lib: $(PROG) debug: clean $(PROG) install: lib copylib -testlib: lib ldconf clean +testlib: clean lib ldconf clean $(CC) $(CFLAGS) -D"TESTLIB=1" -o $(OBJDIR)/main.o $(SRCDIR)/main.c $(LD) $(LDFLAGS) $(OBJDIR)/main.o -o $(PROG) $(LDLIBS) # debug-hoz felüldefiniálva -debug: CFLAGS = -Wall -c -g -g3 -ggdb -std=c89 -Wpedantic -Wmissing-prototypes -D"GIT_VERSION=$(LASTVER)" -D"GIT_MAINVERSION=$(LASTMAIN)" +debug: CFLAGS = -Wall -c -g -g3 -ggdb -std=c89 -Wpedantic -Wmissing-prototypes -D"GIT_LAST=$(LASTVER)" -D"GIT_LASTT=$(LASTVERT)" -D"GIT_MAINT=$(LASTMAINT)" debug: LDLIBS = -lefence # make lib FLAGS: not link: -c, relative addresses: -fPIC -lib: CFLAGS = -fPIC -c -Wall -D"GIT_VERSION=$(LASTVER)" -D"GIT_MAINVERSION=$(LASTMAIN)" +lib: CFLAGS = -fPIC -c -Wall -D"GIT_LAST=$(LASTVER)" -D"GIT_LASTT=$(LASTVERT)" -D"GIT_MAINT=$(LASTMAINT)" lib: LDFLAGS = -shared -Wl,-soname,liblightconfini.so.$(LASTMAIN) lib: LDLIBS = -lc # nem mindegy, hogy mellette van, vagy alatta egy sorral! -- cgit v1.2.3