aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM.Gergő2020-05-26 20:02:32 +0200
committerM.Gergő2020-05-26 20:02:32 +0200
commit764ba227cc4a07d4e40bc4a930459ab14078c43d (patch)
tree4f4366e4822bf225e601392343df43ec0a5f69be
parent245b9c2b398d8fd984a6bac7d46d2b6f4ce0bc0a (diff)
downloadlightconfini-764ba227cc4a07d4e40bc4a930459ab14078c43d.tar.gz
lightconfini-764ba227cc4a07d4e40bc4a930459ab14078c43d.zip
makefile + gcc preprocessor
-rw-r--r--makefile13
1 files 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!