3 UNAME ?= $(shell uname)
4 CYGWIN = $(findstring CYGWIN, $(UNAME))
5 MINGW = $(findstring MINGW32, $(UNAME))
7 CFLAGS += -Wall -Wextra -Werror -Wstrict-aliasing
8 #turn on tons of warnings if clang is present
9 # but also turn off the STUPID ONES
14 -Wno-format-nonliteral \
15 -Wno-disabled-macro-expansion \
18 -Wno-unknown-warning-option \
23 CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
27 CFLAGS += -pedantic-errors
29 CFLAGS += -Wno-pointer-sign -fno-common
33 ifneq ($(shell git describe --always 2>/dev/null),)
34 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
37 ifeq ($(shell valgrind --version 2>/dev/null),)
41 # do this last otherwise there is whitespace in the command output and
42 # it makes my OCD act up
45 #we have duplicate object files when dealing with creating a simple list
46 #for dependinces. To combat this we use some clever recrusive-make to
47 #filter the list and remove duplicates which we use for make depend
48 RMDUP = $(if $1,$(firstword $1) $(call RMDUP,$(filter-out $(firstword $1),$1)))
49 DEPS := $(call RMDUP, $(OBJ_P) $(OBJ_T) $(OBJ_C) $(OBJ_X))
51 ifneq ("$(CYGWIN)", "")
52 #nullify the common variables that
53 #most *nix systems have (for windows)
60 TESTSUITE = testsuite.exe
64 ifneq ("$(MINGW)", "")
65 #nullify the common variables that
66 #most *nix systems have (for windows)
73 TESTSUITE = testsuite.exe
86 $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
89 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
91 $(GMQCC): $(OBJ_C) $(OBJ_D)
92 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
94 $(TESTSUITE): $(OBJ_T)
95 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
98 $(CC) -o $@ $^ $(LDFLAGS)
100 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
107 strip: $(GMQCC) $(QCVM) $(TESTSUITE)
113 rm -rf *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe gm-qcc.tgz ./cov-int
116 @ makedepend -Y -w 65536 2> /dev/null $(subst .o,.c,$(DEPS))
120 @cov-build --dir cov-int $(MAKE)
121 @tar czf gm-qcc.tgz cov-int
123 @echo gm-qcc.tgz generated, submit for analysis
126 install: install-gmqcc install-qcvm install-gmqpak install-doc
127 install-gmqcc: $(GMQCC)
128 install -d -m755 $(DESTDIR)$(BINDIR)
129 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
130 install-qcvm: $(QCVM)
131 install -d -m755 $(DESTDIR)$(BINDIR)
132 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
133 install-gmqpak: $(PAK)
134 install -d -m755 $(DESTDIR)$(BINDIR)
135 install -m755 $(PAK) $(DESTDIR)$(BINDIR)/$(PAK)
137 install -d -m755 $(DESTDIR)$(MANDIR)/man1
138 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
139 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
140 install -m644 doc/gmqpak.1 $(DESTDIR)$(MANDIR)/man1/
144 ansi.o: platform.h gmqcc.h opts.def
145 util.o: gmqcc.h opts.def platform.h
146 stat.o: gmqcc.h opts.def
147 fs.o: gmqcc.h opts.def platform.h
148 opts.o: gmqcc.h opts.def
149 conout.o: gmqcc.h opts.def
150 pak.o: gmqcc.h opts.def
151 test.o: gmqcc.h opts.def platform.h
152 main.o: gmqcc.h opts.def lexer.h
153 lexer.o: gmqcc.h opts.def lexer.h
154 parser.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h
155 code.o: gmqcc.h opts.def
156 ast.o: gmqcc.h opts.def ast.h ir.h parser.h lexer.h
157 ir.o: gmqcc.h opts.def ir.h
158 ftepp.o: gmqcc.h opts.def lexer.h
159 utf8.o: gmqcc.h opts.def
160 correct.o: gmqcc.h opts.def
161 thread.o: gmqcc.h opts.def
162 fold.o: ast.h ir.h gmqcc.h opts.def parser.h lexer.h
163 intrin.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h
164 exec.o: gmqcc.h opts.def