]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - Makefile
Merge branch 'master' into cooking
[xonotic/gmqcc.git] / Makefile
index b3d1bc31461e2cbe7249a7a3cc01c1f0ecbd2415..8f4fb9682c924f292b947302becec9d9acc31ca8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,8 +9,12 @@ UNAME  ?= $(shell uname)
 CYGWIN  = $(findstring CYGWIN,  $(UNAME))
 MINGW   = $(findstring MINGW32, $(UNAME))
 
-CC     ?= clang
-CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
+CC      ?= clang
+# linker flags and optional additional libraries if required
+LDFLAGS :=
+LIBS    :=
+
+CFLAGS  += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
 ifneq ($(shell git describe --always 2>/dev/null),)
     CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
 endif
@@ -32,7 +36,7 @@ else
        #Tiny C Compiler doesn't know what -pedantic-errors is
        # and instead of ignoring .. just errors.
        ifneq ($(CC), tcc)
-               CFLAGS +=-pedantic-errors
+               CFLAGS +=-pedantic-errors -ffunction-sections -fdata-sections -Wl,-gc-sections
        else
                CFLAGS += -Wno-pointer-sign -fno-common
        endif
@@ -100,6 +104,7 @@ GOURCEFLAGS=                  \
     --max-files 99999999999   \
     --max-file-lag 0.000001   \
     --bloom-multiplier 1.3    \
+    --logo doc/html/gmqcc.png \
     -1280x720
 
 #ffmpeg flags for gource
@@ -160,6 +165,7 @@ SPLINTFLAGS =            \
     -realcompare         \
     -observertrans       \
     -shiftnegative       \
+    -freshtrans          \
     -abstract            \
     -statictrans         \
     -castfcnptr
@@ -167,22 +173,22 @@ SPLINTFLAGS =            \
 #standard rules
 default: all
 %.o: %.c
-       $(CC) -c $< -o $@ $(CFLAGS)
+       $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
 
 exec-standalone.o: exec.c
-       $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
+       $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
 
 $(QCVM): $(OBJ_X)
-       $(CC) -o $@ $^ $(CFLAGS) -lm
+       $(CC) -o $@ $^ $(LDFLAGS) -lm $(LIBS)
 
 $(GMQCC): $(OBJ_C) $(OBJ_D)
-       $(CC) -o $@ $^ $(CFLAGS) -lm
+       $(CC) -o $@ $^ $(LDFLAGS) -lm $(LIBS)
 
 $(TESTSUITE): $(OBJ_T)
-       $(CC) -o $@ $^ $(CFLAGS) -lm
+       $(CC) -o $@ $^ $(LDFLAGS) -lm $(LIBS)
 
 $(PAK): $(OBJ_P)
-       $(CC) -o $@ $^ $(CFLAGS)
+       $(CC) -o $@ $^ $(LDFLAGS)
 
 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
 
@@ -219,10 +225,10 @@ depend:
 install: install-gmqcc install-qcvm install-doc
 install-gmqcc: $(GMQCC)
        install -d -m755               $(DESTDIR)$(BINDIR)
-       install    -m755  $(GMQCC)     $(DESTDIR)$(BINDIR)/gmqcc
+       install    -m755  $(GMQCC)     $(DESTDIR)$(BINDIR)/$(GMQCC)
 install-qcvm: $(QCVM)
        install -d -m755               $(DESTDIR)$(BINDIR)
-       install    -m755  $(QCVM)      $(DESTDIR)$(BINDIR)/qcvm
+       install    -m755  $(QCVM)      $(DESTDIR)$(BINDIR)/$(QCVM)
 install-doc:
        install -d -m755               $(DESTDIR)$(MANDIR)/man1
        install    -m644  doc/gmqcc.1  $(DESTDIR)$(MANDIR)/man1/