The-Powder-Toy/Makefile

121 lines
4.5 KiB
Makefile
Raw Normal View History

2011-01-07 08:13:13 -06:00
SOURCES := src/*.c src/elements/*.c
2010-07-25 09:03:39 -05:00
PY_BIN := echo python
PY_VERSION := $(shell $(PY_BIN) -c "import sys;print sys.version[:3]")
PY_LIBPATH := $(shell $(PY_BIN) -c "import os.path,sys;print os.path.join(sys.exec_prefix,\"lib\",\"python%s\"%sys.version[:3],\"config\")")
PY_INCPATH := $(shell $(PY_BIN) -c "import os.path,sys;print os.path.join(sys.exec_prefix,\"include\",\"python%s\"%sys.version[:3])")
PY_LDFLAGS := $(shell $(PY_BIN) -c "import distutils.sysconfig;print distutils.sysconfig.get_config_var('LINKFORSHARED')")
PYCOMMAND := $(PY_BIN) getheader.py
CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -DLUACONSOLE -DGRAVFFT -Iincludes/
2010-07-25 09:03:39 -05:00
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
LFLAGS := -lpthread -lSDL -lfftw3f -lm -lbz2 -lX11 -llua5.1 #-lpython$(PY_VERSION) -L$(PY_LIBPATH) -I$(PY_INCPATH) $(PY_LDFLAGS)
LFLAGS_X := -lm -lbz2 -lSDLmain -I/Library/Frameworks/Python.framework/Versions/$(PY_VERSION)/include/python$(PY_VERSION)
2011-01-01 14:02:00 -06:00
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
MFLAGS_SSE2 := -march=native -DX86 -DX86_SSE2 -msse2
MFLAGS_SSE := -march=native -DX86 -DX86_SSE
FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -msse3 -g
COMPILER := gcc
WIN_COMPILER := gcc
WIN_RES := windres
2010-07-25 09:03:39 -05:00
LINUX_TARG := powder-64-sse2 powder-sse powder-sse2
WIN32_TARG := powder-sse.exe powder-sse2.exe
2010-09-04 16:12:41 -05:00
powder: $(SOURCES)
$(PYCOMMAND)
$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64
2010-12-20 07:05:36 -06:00
mv $@ build
powder-debug-64: $(SOURCES)
2011-03-26 10:45:38 -05:00
$(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/ $(LFLAGS)
2010-12-20 07:05:36 -06:00
mv $@ build
2010-09-04 16:12:41 -05:00
powder-debug: $(SOURCES)
$(PYCOMMAND)
$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64 $(FLAGS_DBUG)
2010-12-20 07:05:36 -06:00
mv $@ build
2011-04-12 06:19:21 -05:00
2010-09-04 16:12:41 -05:00
powder-sse3: $(SOURCES)
$(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN32
2010-08-11 07:48:32 -05:00
strip $@
2010-12-20 07:05:36 -06:00
mv $@ build
2010-09-04 16:12:41 -05:00
powder-sse2: $(SOURCES)
$(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) $(LFLAGS) -DLIN32
2010-08-11 07:48:32 -05:00
strip $@
2010-12-20 07:05:36 -06:00
mv $@ build
2010-09-04 16:12:41 -05:00
powder-sse: $(SOURCES)
$(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) $(LFLAGS) -DLIN32
2010-08-11 07:48:32 -05:00
strip $@
2010-12-20 07:05:36 -06:00
mv $@ build
2011-04-12 06:19:21 -05:00
2010-09-04 16:12:41 -05:00
powder-64-sse3-opengl: $(SOURCES)
2011-03-26 10:45:38 -05:00
$(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64 -lGL -lGLU -DOpenGL
2010-09-03 07:26:54 -05:00
strip $@
2010-12-20 07:05:36 -06:00
mv $@ build
2010-09-04 16:12:41 -05:00
powder-64-sse3: $(SOURCES)
2011-03-26 10:45:38 -05:00
$(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64
2010-08-11 07:48:32 -05:00
strip $@
2010-12-20 07:05:36 -06:00
mv $@ build
2010-09-04 16:12:41 -05:00
powder-64-sse2: $(SOURCES)
2011-03-26 10:45:38 -05:00
$(PYCOMMAND)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) $(LFLAGS) -DLIN64
2010-08-11 07:48:32 -05:00
strip $@
2010-12-20 07:05:36 -06:00
mv $@ build
2010-07-25 09:03:39 -05:00
2010-12-23 17:11:25 -06:00
powder-icc: $(SOURCES)
/opt/intel/Compiler/11.1/073/bin/intel64/icc -m64 -o$@ -Iincludes/ -O2 -march=core2 -msse3 -mfpmath=sse -lSDL -lbz2 -lm -xW $(SOURCES) -std=c99 -D_POSIX_C_SOURCE=200112L
2010-12-23 17:11:25 -06:00
powder-res.o: src/Resources/powder-res.rc src/Resources/powder.ico src/Resources/document.ico
$(WIN_RES) src/Resources/powder-res.rc powder-res.o
2010-09-04 16:12:41 -05:00
powder-sse3.exe: $(SOURCES) powder-res.o
$(PYCOMMAND)
2011-04-24 11:51:03 -05:00
$(WIN_COMPILER) -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lm -lmingw32 -lregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
2010-08-11 07:48:32 -05:00
strip $@
chmod 0644 $@
2010-12-20 07:05:36 -06:00
mv $@ build
2010-09-04 16:12:41 -05:00
powder-sse2.exe: $(SOURCES) powder-res.o
$(PYCOMMAND)
2011-04-24 11:51:03 -05:00
$(WIN_COMPILER) -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lm -lmingw32 -lregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 -ggdb
2010-08-11 07:48:32 -05:00
strip $@
chmod 0644 $@
2010-12-20 07:05:36 -06:00
mv $@ build
2010-09-04 16:12:41 -05:00
powder-sse.exe: $(SOURCES) powder-res.o
$(PYCOMMAND)
2011-04-24 11:51:03 -05:00
$(WIN_COMPILER) -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lm -lmingw32 -lregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
2010-08-11 07:48:32 -05:00
strip $@
chmod 0644 $@
2010-12-20 07:05:36 -06:00
mv $@ build
2011-04-12 06:19:21 -05:00
2010-09-04 16:12:41 -05:00
powder-x: $(SOURCES)
2011-03-22 13:02:22 -05:00
$(PYCOMMAND) --64bit
2011-03-10 14:43:27 -06:00
gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework Python
2010-08-11 07:48:32 -05:00
strip $@
2011-03-22 10:53:16 -05:00
mv $@ build/Powder.app/Contents/MacOS/
2010-09-04 16:12:41 -05:00
powder-x-ogl: $(SOURCES)
2011-03-22 13:02:22 -05:00
$(PYCOMMAND) --64bit
2011-03-10 14:43:27 -06:00
gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework OpenGL -framework Python
2010-09-03 04:32:37 -05:00
strip $@
2010-12-20 12:14:21 -06:00
mv $@ build
render: $(SOURCES)
$(PYCOMMAND)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 -DRENDERER
strip $@
mv $@ build
render-x: $(SOURCES)
$(PYCOMMAND)
$(COMPILER) -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) -lSDL $(MFLAGS) $(SOURCES) -framework Cocoa -DMACOSX -DRENDERER -arch x86_64
strip $@
2011-05-31 11:07:38 -05:00
mv $@ build