X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=Makefile;h=3566bdc99d15c1d12c1f12ec5eaf82b801c49706;hp=9dd66ec8c07d5fd97abd1e397071177eda1f8e33;hb=c74fabffda68fb97716afe9d70744a071f717795;hpb=d4deaa35caf9e9d1571faf5541c2e12e101b544f diff --git a/Makefile b/Makefile index 9dd66ec..3566bdc 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,14 @@ +UNAME ?= $(shell uname) +CYGWIN = $(findstring CYGWIN, $(UNAME)) +MINGW = $(findstring MINGW, $(UNAME)) + +ifneq ("$(CYGWIN)", "") +WINDOWS=1 +endif +ifneq ("$(MINGW)", "") +WINDOWS=1 +endif + CXX ?= clang++ CXXFLAGS = \ -std=c++11 \ @@ -5,7 +16,8 @@ CXXFLAGS = \ -Wextra \ -fno-exceptions \ -fno-rtti \ - -MD + -MD \ + -g3 CSRCS = \ ast.cpp \ @@ -43,31 +55,44 @@ CDEPS = $(CSRCS:.cpp=.d) TDEPS = $(TSRCS:.cpp=.d) VDEPS = $(VSRCS:.cpp=.d) +ifndef WINDOWS CBIN = gmqcc -TBIN = testsuite VBIN = qcvm +TBIN = testsuite +else +CBIN = gmqcc.exe +VBIN = qcvm.exe +endif -all: $(CBIN) $(TBIN) $(VBIN) +ifndef WINDOWS +all: $(CBIN) $(QCVM) $(TBIN) +else +all: $(CBIN) $(QCVM) +endif $(CBIN): $(COBJS) $(CXX) $(COBJS) -o $@ +$(VBIN): $(VOBJS) + $(CXX) $(VOBJS) -o $@ + +ifndef WINDOWS $(TBIN): $(TOBJS) $(CXX) $(TOBJS) -o $@ -$(VBIN): $(VOBJS) - $(CXX) $(VOBJS) -o $@ +test: $(CBIN) $(VBIN) $(TBIN) + @./$(TBIN) +endif .cpp.o: $(CXX) -c $(CXXFLAGS) $< -o $@ -test: $(CBIN) $(TBIN) $(VBIN) - @./$(TBIN) - clean: rm -f *.d rm -f $(COBJS) $(CDEPS) $(CBIN) - rm -f $(TOBJS) $(TDEPS) $(TBIN) rm -f $(VOBJS) $(VDEPS) $(VBIN) +ifndef WINDOWS + rm -f $(TOBJS) $(TDEPS) $(TOBJS) +endif -include *.d