4 BINDIR := $(PREFIX)/bin
5 DATADIR := $(PREFIX)/share
6 MANDIR := $(DATADIR)/man
8 UNAME ?= $(shell uname)
9 CYGWIN = $(findstring CYGWIN, $(UNAME))
10 MINGW = $(findstring MINGW32, $(UNAME))
13 CFLAGS += -Wall -Wextra -Werror -I. -fno-strict-aliasing -fsigned-char $(OPTIONAL)
14 ifneq ($(shell git describe --always 2>/dev/null),)
15 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
17 #turn on tons of warnings if clang is present
18 # but also turn off the STUPID ONES
23 -Wno-format-nonliteral \
24 -Wno-disabled-macro-expansion \
26 -Wno-missing-prototypes \
29 -Wno-missing-variable-declarations \
30 -Wno-unknown-warning-option
32 #Tiny C Compiler doesn't know what -pedantic-errors is
33 # and instead of ignoring .. just errors.
35 CFLAGS +=-pedantic-errors
37 CFLAGS += -Wno-pointer-sign -fno-common
45 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o
46 OBJ_P = util.o fs.o conout.o opts.o pak.o
47 OBJ_T = test.o util.o conout.o fs.o
48 OBJ_C = main.o lexer.o parser.o fs.o
49 OBJ_X = exec-standalone.o util.o conout.o fs.o
51 ifneq ("$(CYGWIN)", "")
52 #nullify the common variables that
53 #most *nix systems have (for windows)
60 TESTSUITE = testsuite.exe
63 ifneq ("$(MINGW)", "")
64 #nullify the common variables that
65 #most *nix systems have (for windows)
72 TESTSUITE = testsuite.exe
75 #arm support for linux .. we need to allow unaligned accesses
76 #to memory otherwise we just segfault everywhere
77 ifneq (, $(findstring arm, $(shell uname -m)))
78 CFLAGS += -munaligned-access
90 --date-format "%d %B, %Y" \
91 --seconds-per-day 0.01 \
92 --auto-skip-seconds 1 \
95 --camera-mode overview \
96 --highlight-all-users \
98 --hide progress,mouse \
100 --max-files 99999999999 \
101 --max-file-lag 0.000001 \
102 --bloom-multiplier 1.3 \
105 #ffmpeg flags for gource
148 -shiftimplementation \
171 $(CC) -c $< -o $@ $(CFLAGS)
173 exec-standalone.o: exec.c
174 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
177 $(CC) -o $@ $^ $(CFLAGS) -lm
179 $(GMQCC): $(OBJ_C) $(OBJ_D)
180 $(CC) -o $@ $^ $(CFLAGS) -lm
182 $(TESTSUITE): $(OBJ_T)
183 $(CC) -o $@ $^ $(CFLAGS) -lm
186 $(CC) -o $@ $^ $(CFLAGS)
188 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
196 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4
199 @ splint $(SPLINTFLAGS) *.c *.h
202 @ gource $(GOURCEFLAGS)
205 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
208 @makedepend -Y -w 65536 2> /dev/null \
209 $(subst .o,.c,$(OBJ_D))
210 @makedepend -a -Y -w 65536 2> /dev/null \
211 $(subst .o,.c,$(OBJ_T))
212 @makedepend -a -Y -w 65536 2> /dev/null \
213 $(subst .o,.c,$(OBJ_C))
214 @makedepend -a -Y -w 65536 2> /dev/null \
215 $(subst .o,.c,$(OBJ_X))
216 @makedepend -a -Y -w 65536 2> /dev/null \
217 $(subst .o,.c,$(OBJ_P))
220 install: install-gmqcc install-qcvm install-doc
221 install-gmqcc: $(GMQCC)
222 install -d -m755 $(DESTDIR)$(BINDIR)
223 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
224 install-qcvm: $(QCVM)
225 install -d -m755 $(DESTDIR)$(BINDIR)
226 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
228 install -d -m755 $(DESTDIR)$(MANDIR)/man1
229 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
230 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
233 rm $(DESTDIR)$(BINDIR)/gmqcc
234 rm $(DESTDIR)$(BINDIR)/qcvm
235 rm $(DESTDIR)$(MANDIR)/man1/doc/gmqcc.1
236 rm $(DESTDIR)$(MANDIR)/man1/doc/qcvm.1
240 util.o: gmqcc.h opts.def
241 code.o: gmqcc.h opts.def
242 ast.o: gmqcc.h opts.def ast.h ir.h
243 ir.o: gmqcc.h opts.def ir.h
244 conout.o: gmqcc.h opts.def
245 ftepp.o: gmqcc.h opts.def lexer.h
246 opts.o: gmqcc.h opts.def
247 fs.o: gmqcc.h opts.def
248 utf8.o: gmqcc.h opts.def
249 correct.o: gmqcc.h opts.def
251 test.o: gmqcc.h opts.def
252 util.o: gmqcc.h opts.def
253 conout.o: gmqcc.h opts.def
254 fs.o: gmqcc.h opts.def
256 main.o: gmqcc.h opts.def lexer.h
257 lexer.o: gmqcc.h opts.def lexer.h
258 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
259 fs.o: gmqcc.h opts.def
261 util.o: gmqcc.h opts.def
262 conout.o: gmqcc.h opts.def
263 fs.o: gmqcc.h opts.def
265 util.o: gmqcc.h opts.def
266 fs.o: gmqcc.h opts.def
267 conout.o: gmqcc.h opts.def
268 opts.o: gmqcc.h opts.def
269 pak.o: gmqcc.h opts.def