2012-05-07 11:59:50 -05:00
|
|
|
HEADERS := $(wildcard src/*.h) $(wildcard src/*/*.h) $(wildcard generated/*.h)
|
2012-01-08 11:39:03 -06:00
|
|
|
|
2012-05-07 11:59:50 -05:00
|
|
|
SOURCES := $(wildcard src/*.cpp) $(wildcard src/*/*.cpp) $(wildcard src/*/*/*.cpp) $(wildcard generated/*.cpp)
|
2012-05-30 06:32:58 -05:00
|
|
|
GENERATEDSOURCES := $(wildcard src/*/*/*.h) $(wildcard src/*/*/*.cpp)
|
2012-01-20 16:07:49 -06:00
|
|
|
OBJS := $(patsubst src/%.cpp,build/obj/%.o,$(SOURCES))
|
2012-01-08 11:39:03 -06:00
|
|
|
|
2012-05-07 11:59:50 -05:00
|
|
|
CFLAGS := -w -Isrc/ -Idata/ -Igenerated/
|
2012-02-12 06:53:11 -06:00
|
|
|
OFLAGS := -fkeep-inline-functions
|
2012-01-08 11:39:03 -06:00
|
|
|
|
|
|
|
CPPC := g++
|
2012-01-27 07:41:35 -06:00
|
|
|
CPPC_WIN := g++
|
|
|
|
WIN_RES := windres
|
2012-01-08 11:39:03 -06:00
|
|
|
|
2012-01-20 16:07:49 -06:00
|
|
|
all: build/powder
|
|
|
|
|
2012-01-27 07:28:46 -06:00
|
|
|
powder-release.exe: build/powder-release.exe
|
2012-01-10 16:16:42 -06:00
|
|
|
powder.exe: build/powder.exe
|
2012-01-27 07:28:46 -06:00
|
|
|
powder-release: build/powder-release
|
2012-06-20 14:05:25 -05:00
|
|
|
powder-opengl-release: build/powder-opengl-release
|
2012-01-20 16:07:49 -06:00
|
|
|
powder: build/powder
|
2012-06-20 14:12:44 -05:00
|
|
|
powder-opengl: build/powder-opengl
|
2012-04-26 07:10:47 -05:00
|
|
|
powder-x: build/powder-x
|
2012-05-31 04:24:44 -05:00
|
|
|
powder-x.jnilib: build/powder-x.jnilib
|
2012-01-20 16:07:49 -06:00
|
|
|
|
2012-04-23 11:32:37 -05:00
|
|
|
build/powder-release.exe: CFLAGS += -DWIN32 -O3 -ftree-vectorize -msse2 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations
|
2012-06-20 13:48:34 -05:00
|
|
|
build/powder-release.exe: LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 -llua -lfftw3f-3 -mwindows
|
2012-04-16 07:58:20 -05:00
|
|
|
build/powder.exe: CFLAGS += -DWIN32
|
|
|
|
build/powder.exe: LFLAGS := -lmingw32 -lregex -lws2_32 -lSDLmain -lpthread -lSDL -lm -lbz2 -llua -lfftw3f-3 #-mwindows
|
2012-06-20 13:48:34 -05:00
|
|
|
build/powder-release: CFLAGS += -DLIN32 -O3 -ftree-vectorize -msse3 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations
|
|
|
|
build/powder-release: LFLAGS := -lSDL -lm -lbz2 -llua -lfftw3f
|
2012-06-20 14:05:25 -05:00
|
|
|
build/powder-opengl-release: CFLAGS += -DLIN32 -O3 -ftree-vectorize -msse3 -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations -DOGLR -DPIX32OGL -DPIXALPHA
|
|
|
|
build/powder-opengl-release: LFLAGS := -lSDL -lm -lbz2 -llua -lfftw3f -lGL -lGLEW -DOGLR -DPIX32OGL -DPIXALPHA
|
2012-06-20 13:48:34 -05:00
|
|
|
build/powder: CFLAGS += -DLIN32
|
|
|
|
build/powder: LFLAGS := -lSDL -lm -lbz2 -llua -lfftw3f
|
2012-06-20 14:12:44 -05:00
|
|
|
build/powder-opengl: CFLAGS += -DLIN32 -DOGLR -DPIX32OGL -DPIXALPHA
|
|
|
|
build/powder-opengl: LFLAGS := -lSDL -lm -lbz2 -llua -lfftw3f -lGL -lGLEW
|
2012-05-12 16:31:58 -05:00
|
|
|
#build/powder-x: CFLAGS += -DMACOSX -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/Lua.framework/Headers -I/Library/Frameworks/OpenGL.framework/Headers -DOGLR -DPIX32OGL -DPIXALPHA
|
|
|
|
#build/powder-x: LFLAGS := -lm -lbz2 -lfftw3f -framework SDL -framework Lua -framework Cocoa -framework OpenGL
|
|
|
|
build/powder-x: CFLAGS += -DMACOSX -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/Lua.framework/Headers -DPIX32BGRA
|
2012-04-26 07:10:47 -05:00
|
|
|
build/powder-x: LFLAGS := -lm -lbz2 -lfftw3f -framework SDL -framework Lua -framework Cocoa
|
2012-05-31 04:24:44 -05:00
|
|
|
build/powder-x.jnilib: CFLAGS += -DMACOSX -DUSE_JNI -I/Library/Frameworks/Lua.framework/Headers -I/System/Library/Frameworks/JavaVM.framework/Headers -DOGLR -DPIX32OGL -DPIXALPHA
|
|
|
|
build/powder-x.jnilib: LFLAGS := -lm -lbz2 -lfftw3f -framework Lua -framework JavaVM -framework Cocoa -framework OpenGL
|
2012-04-16 07:58:20 -05:00
|
|
|
|
2012-06-13 13:49:41 -05:00
|
|
|
CFLAGS += -DGRAVFFT -DLUACONSOLE -DUSE_SDL
|
2012-01-20 16:07:49 -06:00
|
|
|
|
2012-05-12 16:31:58 -05:00
|
|
|
build/powder-release.exe: $(SOURCES) generate build/powder-res.o
|
2012-01-27 07:41:35 -06:00
|
|
|
$(CPPC_WIN) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(SOURCES) $(LFLAGS) build/powder-res.o -o $@
|
2012-01-27 07:28:46 -06:00
|
|
|
strip $@
|
2012-01-27 07:41:35 -06:00
|
|
|
build/powder-res.o: resources/powder-res.rc resources/powder.ico resources/document.ico
|
|
|
|
cd resources && $(WIN_RES) powder-res.rc powder-res.o
|
|
|
|
mv resources/powder-res.o build/powder-res.o
|
2012-01-27 07:28:46 -06:00
|
|
|
build/powder-release: $(SOURCES)
|
|
|
|
$(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(SOURCES) $(LFLAGS) -o $@
|
2012-06-20 13:48:34 -05:00
|
|
|
strip $@
|
2012-06-20 14:05:25 -05:00
|
|
|
build/powder-opengl-release: $(SOURCES)
|
|
|
|
$(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(SOURCES) $(LFLAGS) -o $@
|
|
|
|
strip $@
|
2012-05-12 16:31:58 -05:00
|
|
|
build/powder.exe: buildpaths-powder.exe generate $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) build/powder-res.o
|
2012-02-12 06:53:11 -06:00
|
|
|
$(CPPC_WIN) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)) build/powder-res.o $(LFLAGS) -o $@ -ggdb
|
2012-01-17 14:46:06 -06:00
|
|
|
build/obj/powder.exe/%.o: src/%.cpp $(HEADERS)
|
2012-01-27 07:41:35 -06:00
|
|
|
$(CPPC_WIN) -c $(CFLAGS) $(OFLAGS) -o $@ $< -ggdb
|
2012-01-20 16:07:49 -06:00
|
|
|
buildpaths-powder.exe:
|
2012-02-12 09:32:04 -06:00
|
|
|
$(shell mkdir -p build/obj/powder.exe/)
|
|
|
|
$(shell mkdir -p $(sort $(dir $(patsubst build/obj/%.o,build/obj/powder.exe/%.o,$(OBJS)))))
|
2012-01-20 16:07:49 -06:00
|
|
|
|
2012-05-12 16:31:58 -05:00
|
|
|
build/powder: buildpaths-powder generate $(patsubst build/obj/%.o,build/obj/powder/%.o,$(OBJS))
|
2012-01-20 16:07:49 -06:00
|
|
|
$(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder/%.o,$(OBJS)) $(LFLAGS) -o $@ -ggdb
|
2012-06-20 14:13:18 -05:00
|
|
|
build/powder-opengl: buildpaths-powder-opengl generate $(patsubst build/obj/%.o,build/obj/powder-opengl/%.o,$(OBJS))
|
2012-06-20 14:12:44 -05:00
|
|
|
$(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder-opengl/%.o,$(OBJS)) $(LFLAGS) -o $@ -ggdb
|
2012-01-20 16:07:49 -06:00
|
|
|
build/obj/powder/%.o: src/%.cpp $(HEADERS)
|
|
|
|
$(CPPC) -c $(CFLAGS) $(OFLAGS) -o $@ $< -ggdb
|
2012-06-20 14:13:18 -05:00
|
|
|
build/obj/powder-opengl/%.o: src/%.cpp $(HEADERS)
|
|
|
|
$(CPPC) -c $(CFLAGS) $(OFLAGS) -o $@ $< -ggdb
|
2012-01-20 16:07:49 -06:00
|
|
|
buildpaths-powder:
|
2012-02-12 09:32:04 -06:00
|
|
|
$(shell mkdir -p build/obj/powder/)
|
|
|
|
$(shell mkdir -p $(sort $(dir $(patsubst build/obj/%.o,build/obj/powder/%.o,$(OBJS)))))
|
2012-06-20 14:12:44 -05:00
|
|
|
buildpaths-powder-opengl:
|
|
|
|
$(shell mkdir -p build/obj/powder-opengl/)
|
|
|
|
$(shell mkdir -p $(sort $(dir $(patsubst build/obj/%.o,build/obj/powder-opengl/%.o,$(OBJS)))))
|
2012-05-07 11:59:50 -05:00
|
|
|
build/powder-x: buildpaths-powder-x generate $(patsubst build/obj/%.o,build/obj/powder-x/%.o,$(OBJS))
|
2012-04-26 07:10:47 -05:00
|
|
|
$(CPPC) $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder-x/%.o,$(OBJS)) SDLmain.m $(LFLAGS) -o $@ -ggdb
|
|
|
|
build/obj/powder-x/%.o: src/%.cpp $(HEADERS)
|
|
|
|
$(CPPC) -c $(CFLAGS) $(OFLAGS) -o $@ $< -ggdb
|
|
|
|
buildpaths-powder-x:
|
|
|
|
$(shell mkdir -p build/obj/powder-x/)
|
|
|
|
$(shell mkdir -p $(sort $(dir $(patsubst build/obj/%.o,build/obj/powder-x/%.o,$(OBJS)))))
|
2012-05-31 04:24:44 -05:00
|
|
|
|
|
|
|
build/powder-x.jnilib: buildpaths-powder-x.jnilib generate $(patsubst build/obj/%.o,build/obj/powder-x.jnilib/%.o,$(OBJS))
|
|
|
|
$(CPPC) -dynamiclib $(CFLAGS) $(OFLAGS) $(LDFLAGS) $(patsubst build/obj/%.o,build/obj/powder-x.jnilib/%.o,$(OBJS)) src/powdertoyjava/OpenGLCanvasMacOS.mm $(LFLAGS) -o $@ -ggdb
|
|
|
|
build/obj/powder-x.jnilib/%.o: src/%.cpp $(HEADERS)
|
|
|
|
$(CPPC) -c $(CFLAGS) $(OFLAGS) -o $@ $< -ggdb
|
|
|
|
buildpaths-powder-x.jnilib:
|
|
|
|
$(shell mkdir -p build/obj/powder-x.jnilib/)
|
|
|
|
$(shell mkdir -p $(sort $(dir $(patsubst build/obj/%.o,build/obj/powder-x.jnilib/%.o,$(OBJS)))))
|
2012-01-08 11:39:03 -06:00
|
|
|
|
2012-05-30 06:32:58 -05:00
|
|
|
generate: $(GENERATEDSOURCES)
|
|
|
|
touch generate
|
2012-05-07 11:59:50 -05:00
|
|
|
python generator.py
|
|
|
|
|
2012-01-08 11:39:03 -06:00
|
|
|
clean:
|
2012-01-20 16:07:49 -06:00
|
|
|
rm -r build/obj/*
|
2012-01-20 16:19:45 -06:00
|
|
|
rm build/*.exe
|