X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=Makefile;h=c6a6327ed02269a35d0146662a6edac6007ccbbc;hb=dedb3a49bdb619bf4fc303e0da6d4740fc9a4527;hp=660ec843d17b7e6a458e9aec00bfa855ee67af94;hpb=a3791b3f51ee63cb9f04d608f972830b96c298f7;p=xonotic%2Fgmqcc.git diff --git a/Makefile b/Makefile index 660ec84..c6a6327 100644 --- a/Makefile +++ b/Makefile @@ -1,64 +1,74 @@ -CC ?= clang -CFLAGS += -Wall -I. -pedantic-errors +CXX ?= clang++ +CXXFLAGS = \ + -std=c++11 \ + -Wall \ + -Wextra \ + -fno-exceptions \ + -fno-rtti \ + -MD \ + -g3 -#turn on tons of warnings if clang is present -ifeq ($(CC), clang) - CFLAGS += \ - -Weverything \ - -Wno-missing-prototypes \ - -Wno-unused-parameter \ - -Wno-sign-compare \ - -Wno-implicit-fallthrough \ - -Wno-sign-conversion \ - -Wno-conversion \ - -Wno-disabled-macro-expansion \ - -Wno-padded \ - -Wno-format-nonliteral +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 -endif -ifeq ($(track), no) - CFLAGS += -DNOTRACK -endif +TSRCS = \ + conout.cpp \ + opts.cpp \ + stat.cpp \ + test.cpp \ + util.cpp -OBJ = \ - util.o \ - code.o \ - ast.o \ - ir.o \ - preprocess.o \ - error.o -OBJ_A = test/ast-test.o -OBJ_I = test/ir-test.o -OBJ_C = main.o lexer.o parser.o -OBJ_X = exec-standalone.o util.o +VSRCS = \ + exec.cpp \ + stat.cpp \ + util.cpp -#default is compiler only -default: gmqcc -%.o: %.c - $(CC) -c $< -o $@ $(CFLAGS) +COBJS = $(CSRCS:.cpp=.o) +TOBJS = $(TSRCS:.cpp=.o) +VOBJS = $(VSRCS:.cpp=.o) -exec-standalone.o: exec.c - $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1 +CDEPS = $(CSRCS:.cpp=.d) +TDEPS = $(TSRCS:.cpp=.d) +VDEPS = $(VSRCS:.cpp=.d) -# test targets -test_ast: $(OBJ_A) $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) -test_ir: $(OBJ_I) $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) -qcvm: $(OBJ_X) - $(CC) -o $@ $^ $(CFLAGS) -lm -exec.o: execloop.h -exec-standalone.o: execloop.h -test: test_ast test_ir +CBIN = gmqcc +TBIN = testsuite +VBIN = qcvm -# compiler target -gmqcc: $(OBJ_C) $(OBJ) - $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +all: $(CBIN) $(TBIN) $(VBIN) -#all target is test and all -all: test gmqcc +$(CBIN): $(COBJS) + $(CXX) $(COBJS) -o $@ + +$(TBIN): $(TOBJS) + $(CXX) $(TOBJS) -o $@ + +$(VBIN): $(VOBJS) + $(CXX) $(VOBJS) -o $@ + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $< -o $@ + +test: $(CBIN) $(TBIN) $(VBIN) + @./$(TBIN) clean: - rm -f *.o gmqcc qcvm test_ast test_ir test/*.o - + rm -f *.d + rm -f $(COBJS) $(CDEPS) $(CBIN) + rm -f $(TOBJS) $(TDEPS) $(TBIN) + rm -f $(VOBJS) $(VDEPS) $(VBIN) +-include *.d