X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=Makefile;h=35b825a1f917a9d0a74898471f54c2a4d2db1d54;hp=cd576ba1a88b284b557808a7576110910a5f963f;hb=69b55ccc03b56af1f6c05eb45866ab198307487f;hpb=9a1894f587c332bae5d5b6b99bf1b9c1dfad1353 diff --git a/Makefile b/Makefile index cd576ba..35b825a 100644 --- 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 += -lm + +CFLAGS += -Wall -Wextra -Werror -fno-strict-aliasing $(OPTIONAL) ifneq ($(shell git describe --always 2>/dev/null),) CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\"" endif @@ -25,14 +29,12 @@ ifeq ($(CC), clang) -Wno-conversion \ -Wno-missing-prototypes \ -Wno-float-equal \ - -Wno-cast-align \ - -Wno-missing-variable-declarations \ -Wno-unknown-warning-option else #Tiny C Compiler doesn't know what -pedantic-errors is # and instead of ignoring .. just errors. ifneq ($(CC), tcc) - CFLAGS +=-pedantic-errors -ffunction-sections -fdata-sections -Wl,-gc-sections + CFLAGS += -pedantic-errors else CFLAGS += -Wno-pointer-sign -fno-common endif @@ -72,12 +74,6 @@ ifneq ("$(MINGW)", "") TESTSUITE = testsuite.exe PAK = pak.exe else - #arm support for linux .. we need to allow unaligned accesses - #to memory otherwise we just segfault everywhere - ifneq (, $(findstring arm, $(shell uname -m))) - CFLAGS += -munaligned-access - endif - QCVM = qcvm GMQCC = gmqcc TESTSUITE = testsuite @@ -169,22 +165,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) $(LIBS) $(GMQCC): $(OBJ_C) $(OBJ_D) - $(CC) -o $@ $^ $(CFLAGS) -lm + $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) $(TESTSUITE): $(OBJ_T) - $(CC) -o $@ $^ $(CFLAGS) -lm + $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) $(PAK): $(OBJ_P) - $(CC) -o $@ $^ $(CFLAGS) + $(CC) -o $@ $^ $(LDFLAGS) all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) @@ -194,7 +190,7 @@ test: all @ ./$(TESTSUITE) clean: - rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 + rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe splint: @ splint $(SPLINTFLAGS) *.c *.h