3 UNAME ?= $(shell uname)
4 CYGWIN = $(findstring CYGWIN, $(UNAME))
5 MINGW = $(findstring MINGW32, $(UNAME))
7 CFLAGS += -O3 -Wall -Wextra -Werror -fno-strict-aliasing $(OPTIONAL)
8 ifneq ($(shell git describe --always 2>/dev/null),)
9 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
11 #turn on tons of warnings if clang is present
12 # but also turn off the STUPID ONES
17 -Wno-format-nonliteral \
18 -Wno-disabled-macro-expansion \
20 -Wno-missing-prototypes \
22 -Wno-unknown-warning-option \
26 #Tiny C Compiler doesn't know what -pedantic-errors is
27 # and instead of ignoring .. just errors.
29 CFLAGS += -pedantic-errors
31 CFLAGS += -Wno-pointer-sign -fno-common
34 #-Wstrict-prototypes is not valid in g++
36 CFLAGS += -Wstrict-prototypes
40 #we have duplicate object files when dealing with creating a simple list
41 #for dependinces. To combat this we use some clever recrusive-make to
42 #filter the list and remove duplicates which we use for make depend
43 RMDUP = $(if $1,$(firstword $1) $(call RMDUP,$(filter-out $(firstword $1),$1)))
44 DEPS := $(call RMDUP, $(OBJ_P) $(OBJ_T) $(OBJ_C) $(OBJ_X))
46 ifneq ("$(CYGWIN)", "")
47 #nullify the common variables that
48 #most *nix systems have (for windows)
55 TESTSUITE = testsuite.exe
58 ifneq ("$(MINGW)", "")
59 #nullify the common variables that
60 #most *nix systems have (for windows)
67 TESTSUITE = testsuite.exe
79 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
81 exec-standalone.o: exec.c
82 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
85 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
87 $(GMQCC): $(OBJ_C) $(OBJ_D)
88 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
90 $(TESTSUITE): $(OBJ_T)
91 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
94 $(CC) -o $@ $^ $(LDFLAGS)
96 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
104 rm -rf *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe gm-qcc.tgz ./cov-int
107 @ splint $(SPLINTFLAGS) *.c *.h
110 @ gource $(GOURCEFLAGS)
113 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
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 util.o: gmqcc.h opts.def
145 fs.o: gmqcc.h opts.def
146 conout.o: gmqcc.h opts.def
147 opts.o: gmqcc.h opts.def
148 pak.o: gmqcc.h opts.def
149 stat.o: gmqcc.h opts.def
150 test.o: gmqcc.h opts.def
151 main.o: gmqcc.h opts.def lexer.h
152 lexer.o: gmqcc.h opts.def lexer.h
153 parser.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
154 code.o: gmqcc.h opts.def
155 ast.o: gmqcc.h opts.def ast.h ir.h parser.h lexer.h
156 ir.o: gmqcc.h opts.def ir.h
157 ftepp.o: gmqcc.h opts.def lexer.h
158 utf8.o: gmqcc.h opts.def
159 correct.o: gmqcc.h opts.def
160 fold.o: ast.h ir.h gmqcc.h opts.def parser.h lexer.h