3 UNAME ?= $(shell uname)
4 CYGWIN = $(findstring CYGWIN, $(UNAME))
5 MINGW = $(findstring MINGW, $(UNAME))
7 # turn on tons of warnings if clang is present
8 # but also turn off the STUPID ONES
13 -Wno-format-nonliteral \
14 -Wno-disabled-macro-expansion \
17 -Wno-unknown-warning-option \
24 CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
28 CFLAGS += -pedantic-errors
30 CFLAGS += -Wno-pointer-sign -fno-common
34 ifneq ($(shell git describe --always 2>/dev/null),)
35 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
38 ifeq ($(shell valgrind --version 2>/dev/null),)
42 # do this last otherwise there is whitespace in the command output and
43 # it makes my OCD act up
44 CFLAGS += $(OPTIONAL_CFLAGS)
45 LDFLAGS += $(OPTIONAL_LDFLAGS)
47 #we have duplicate object files when dealing with creating a simple list
48 #for dependinces. To combat this we use some clever recrusive-make to
49 #filter the list and remove duplicates which we use for make depend
50 RMDUP = $(if $1,$(firstword $1) $(call RMDUP,$(filter-out $(firstword $1),$1)))
51 DEPS := $(call RMDUP, $(OBJ_P) $(OBJ_T) $(OBJ_C) $(OBJ_X))
53 ifneq ("$(CYGWIN)", "")
54 #nullify the common variables that
55 #most *nix systems have (for windows)
62 TESTSUITE = testsuite.exe
66 ifneq ("$(MINGW)", "")
67 #nullify the common variables that
68 #most *nix systems have (for windows)
75 TESTSUITE = testsuite.exe
88 $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
91 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
93 $(GMQCC): $(OBJ_C) $(OBJ_D)
94 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
96 $(TESTSUITE): $(OBJ_T)
97 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
100 $(CC) -o $@ $^ $(LDFLAGS)
102 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
109 strip: $(GMQCC) $(QCVM) $(TESTSUITE)
115 rm -rf *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe gm-qcc.tgz ./cov-int
118 @ makedepend -Y -w 65536 2> /dev/null $(subst .o,.c,$(DEPS))
122 @cov-build --dir cov-int $(MAKE)
123 @tar czf gm-qcc.tgz cov-int
125 @echo gm-qcc.tgz generated, submit for analysis
128 install: install-gmqcc install-qcvm install-gmqpak install-doc
129 install-gmqcc: $(GMQCC)
130 install -d -m755 $(DESTDIR)$(BINDIR)
131 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
132 install-qcvm: $(QCVM)
133 install -d -m755 $(DESTDIR)$(BINDIR)
134 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
135 install-gmqpak: $(PAK)
136 install -d -m755 $(DESTDIR)$(BINDIR)
137 install -m755 $(PAK) $(DESTDIR)$(BINDIR)/$(PAK)
139 install -d -m755 $(DESTDIR)$(MANDIR)/man1
140 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
141 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
142 install -m644 doc/gmqpak.1 $(DESTDIR)$(MANDIR)/man1/
146 ansi.o: platform.h gmqcc.h opts.def
147 util.o: gmqcc.h opts.def platform.h
148 hash.o: gmqcc.h opts.def
149 stat.o: gmqcc.h opts.def
150 fs.o: gmqcc.h opts.def platform.h
151 opts.o: gmqcc.h opts.def
152 conout.o: gmqcc.h opts.def
153 pak.o: gmqcc.h opts.def
154 test.o: gmqcc.h opts.def platform.h
155 main.o: gmqcc.h opts.def lexer.h
156 lexer.o: gmqcc.h opts.def lexer.h
157 parser.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h
158 code.o: gmqcc.h opts.def
159 ast.o: gmqcc.h opts.def ast.h ir.h parser.h lexer.h
160 ir.o: gmqcc.h opts.def ir.h
161 ftepp.o: gmqcc.h opts.def lexer.h
162 utf8.o: gmqcc.h opts.def
163 correct.o: gmqcc.h opts.def
164 fold.o: ast.h ir.h gmqcc.h opts.def parser.h lexer.h
165 intrin.o: parser.h gmqcc.h opts.def lexer.h ast.h ir.h
166 exec.o: gmqcc.h opts.def