2016-01-03 05:34:29 +00:00
|
|
|
UNAME ?= $(shell uname)
|
|
|
|
CYGWIN = $(findstring CYGWIN, $(UNAME))
|
2016-01-03 05:35:12 +00:00
|
|
|
MINGW = $(findstring MINGW, $(UNAME))
|
2016-01-03 05:34:29 +00:00
|
|
|
|
|
|
|
ifneq ("$(CYGWIN)", "")
|
|
|
|
WINDOWS=1
|
|
|
|
endif
|
|
|
|
ifneq ("$(MINGW)", "")
|
|
|
|
WINDOWS=1
|
|
|
|
endif
|
|
|
|
|
2015-01-15 02:48:47 +00:00
|
|
|
CXX ?= clang++
|
|
|
|
CXXFLAGS = \
|
|
|
|
-std=c++11 \
|
|
|
|
-Wall \
|
|
|
|
-Wextra \
|
2018-09-01 04:48:18 +00:00
|
|
|
-Wno-parentheses \
|
|
|
|
-Wno-class-memaccess \
|
2015-01-15 02:48:47 +00:00
|
|
|
-fno-exceptions \
|
|
|
|
-fno-rtti \
|
2015-01-15 04:34:43 +00:00
|
|
|
-MD \
|
|
|
|
-g3
|
2012-12-20 00:22:22 +00:00
|
|
|
|
2015-01-15 02:48:47 +00:00
|
|
|
CSRCS = \
|
|
|
|
ast.cpp \
|
|
|
|
code.cpp \
|
|
|
|
conout.cpp \
|
|
|
|
fold.cpp \
|
|
|
|
ftepp.cpp \
|
|
|
|
intrin.cpp \
|
|
|
|
ir.cpp \
|
|
|
|
lexer.cpp \
|
|
|
|
main.cpp \
|
|
|
|
opts.cpp \
|
|
|
|
parser.cpp \
|
|
|
|
stat.cpp \
|
|
|
|
utf8.cpp \
|
|
|
|
util.cpp
|
2012-11-17 10:00:32 +00:00
|
|
|
|
2015-01-15 02:48:47 +00:00
|
|
|
TSRCS = \
|
|
|
|
conout.cpp \
|
|
|
|
opts.cpp \
|
|
|
|
stat.cpp \
|
|
|
|
test.cpp \
|
|
|
|
util.cpp
|
2013-08-16 03:28:02 +00:00
|
|
|
|
2015-01-15 02:48:47 +00:00
|
|
|
VSRCS = \
|
|
|
|
exec.cpp \
|
|
|
|
stat.cpp \
|
|
|
|
util.cpp
|
|
|
|
|
|
|
|
COBJS = $(CSRCS:.cpp=.o)
|
|
|
|
TOBJS = $(TSRCS:.cpp=.o)
|
|
|
|
VOBJS = $(VSRCS:.cpp=.o)
|
|
|
|
|
|
|
|
CDEPS = $(CSRCS:.cpp=.d)
|
|
|
|
TDEPS = $(TSRCS:.cpp=.d)
|
|
|
|
VDEPS = $(VSRCS:.cpp=.d)
|
2012-12-28 09:30:01 +00:00
|
|
|
|
2016-01-03 05:34:29 +00:00
|
|
|
ifndef WINDOWS
|
2015-01-14 01:07:17 +00:00
|
|
|
CBIN = gmqcc
|
2015-01-14 01:36:25 +00:00
|
|
|
VBIN = qcvm
|
2016-01-03 05:34:29 +00:00
|
|
|
TBIN = testsuite
|
|
|
|
else
|
|
|
|
CBIN = gmqcc.exe
|
2016-01-03 05:38:58 +00:00
|
|
|
VBIN = qcvm.exe
|
2016-01-03 05:34:29 +00:00
|
|
|
endif
|
2013-08-16 07:33:57 +00:00
|
|
|
|
2016-01-03 05:34:29 +00:00
|
|
|
ifndef WINDOWS
|
|
|
|
all: $(CBIN) $(QCVM) $(TBIN)
|
|
|
|
else
|
|
|
|
all: $(CBIN) $(QCVM)
|
|
|
|
endif
|
2013-08-16 03:28:02 +00:00
|
|
|
|
2015-01-14 01:07:17 +00:00
|
|
|
$(CBIN): $(COBJS)
|
2015-01-15 02:48:47 +00:00
|
|
|
$(CXX) $(COBJS) -o $@
|
2013-08-16 03:28:02 +00:00
|
|
|
|
2016-01-03 05:34:29 +00:00
|
|
|
$(VBIN): $(VOBJS)
|
|
|
|
$(CXX) $(VOBJS) -o $@
|
|
|
|
|
|
|
|
ifndef WINDOWS
|
2015-01-14 01:07:17 +00:00
|
|
|
$(TBIN): $(TOBJS)
|
2015-01-15 02:48:47 +00:00
|
|
|
$(CXX) $(TOBJS) -o $@
|
2013-04-28 03:50:22 +00:00
|
|
|
|
2016-01-03 05:38:58 +00:00
|
|
|
test: $(CBIN) $(VBIN) $(TBIN)
|
2016-01-03 05:34:29 +00:00
|
|
|
@./$(TBIN)
|
|
|
|
endif
|
2015-01-14 01:36:25 +00:00
|
|
|
|
2015-01-15 02:48:47 +00:00
|
|
|
.cpp.o:
|
|
|
|
$(CXX) -c $(CXXFLAGS) $< -o $@
|
2012-11-17 10:00:55 +00:00
|
|
|
|
2012-04-09 10:42:06 +00:00
|
|
|
clean:
|
2015-01-14 01:07:17 +00:00
|
|
|
rm -f *.d
|
|
|
|
rm -f $(COBJS) $(CDEPS) $(CBIN)
|
2015-01-14 01:36:25 +00:00
|
|
|
rm -f $(VOBJS) $(VDEPS) $(VBIN)
|
2016-01-03 05:34:29 +00:00
|
|
|
ifndef WINDOWS
|
|
|
|
rm -f $(TOBJS) $(TDEPS) $(TOBJS)
|
|
|
|
endif
|
2015-01-14 01:29:46 +00:00
|
|
|
|
|
|
|
-include *.d
|