Created
December 18, 2014 19:48
-
-
Save pmsanford/6d6e4f46140ef23ffdd9 to your computer and use it in GitHub Desktop.
OSX libtcod makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# libtcod makefile | |
# to build debug version, run "make -f makefile-linux debug" | |
# to build release version, run "make -f makefile-linux release" | |
SRCDIR=src | |
INCDIR=include | |
#dependencies | |
# SDL | |
SDL_FLAGS=`sdl-config --cflags` | |
SDL_LIBS=`sdl-config --libs` | |
# ZLIB | |
ZLIB_FLAGS=-I src/zlib | |
ZLIB_LIBS=lib/libz.a | |
#OPENGL | |
OPENGL_LIB=-framework OpenGL | |
OSXCOMPAT=osx/macsupport.m -framework Cocoa | |
LIBS=$(ZLIB_LIBS) $(SDL_LIBS) $(OPENGL_LIB) -lm -ldl -lpthread | |
CFLAGS=$(FLAGS) -I$(INCDIR) -I$(INCDIR)/gui -Wall $(SDL_FLAGS) $(ZLIB_FLAGS) -fno-strict-aliasing -ansi -fPIC | |
TEMP=/tmp | |
CC=clang | |
CPP=clang++ | |
.SUFFIXES: a .o .h .c | |
$(TEMP)/libtcod/release/%.o : $(SRCDIR)/%.c | |
@ echo Compiling release $(basename $<).c | |
@$(CC) $(CFLAGS) -O2 -DNDEBUG -s -o $@ -c $< | |
$(TEMP)/libtcod/release/%.o : $(SRCDIR)/%.cpp | |
@ echo Compiling release $(basename $<).cpp | |
@$(CPP) $(CFLAGS) -O2 -DNDEBUG -s -o $@ -c $< | |
$(TEMP)/libtcod/release/gui/%.o : $(SRCDIR)/gui/%.cpp | |
@ echo Compiling release $(basename $<).cpp | |
@$(CPP) $(CFLAGS) -O2 -DNDEBUG -s -o $@ -c $< | |
$(TEMP)/libtcod/debug/%.o : $(SRCDIR)/%.c | |
@echo Compiling debug $(basename $<).c | |
@$(CC) $(CFLAGS) -g -o $@ -c $< | |
$(TEMP)/libtcod/debug/%.o : $(SRCDIR)/%.cpp | |
@echo Compiling debug $(basename $<).cpp | |
@$(CPP) $(CFLAGS) -g -o $@ -c $< | |
$(TEMP)/libtcod/debug/gui/%.o : $(SRCDIR)/gui/%.cpp | |
@echo Compiling debug $(basename $<).cpp | |
@$(CPP) $(CFLAGS) -g -o $@ -c $< | |
$(TEMP)/libtcod/zlib/%.o : $(SRCDIR)/zlib/%.c | |
@ echo Compiling zlib $(basename $<).c | |
@$(CC) $(CFLAGS) -DNDEBUG -O2 -s -o $@ -c $< | |
ZLIBOBJS=$(addprefix $(TEMP)/libtcod/zlib/, \ | |
adler32.o \ | |
crc32.o \ | |
deflate.o \ | |
infback.o \ | |
inffast.o \ | |
inflate.o \ | |
inftrees.o \ | |
trees.o \ | |
zutil.o \ | |
compress.o \ | |
uncompr.o \ | |
gzclose.o \ | |
gzlib.o \ | |
gzread.o \ | |
gzwrite.o ) | |
LIBOBJS_C= \ | |
bresenham_c.o \ | |
bsp_c.o \ | |
color_c.o \ | |
console_c.o \ | |
fov_c.o \ | |
fov_circular_raycasting.o \ | |
fov_diamond_raycasting.o \ | |
fov_recursive_shadowcasting.o \ | |
fov_permissive2.o \ | |
fov_restrictive.o \ | |
heightmap_c.o \ | |
image_c.o \ | |
lex_c.o \ | |
list_c.o \ | |
mersenne_c.o \ | |
noise_c.o \ | |
parser_c.o \ | |
path_c.o \ | |
sys_c.o \ | |
sys_opengl_c.o \ | |
sys_sdl_c.o \ | |
sys_sdl_img_bmp.o \ | |
sys_sdl_img_png.o \ | |
tree_c.o \ | |
txtfield_c.o \ | |
wrappers.o \ | |
zip_c.o \ | |
namegen_c.o \ | |
png/lodepng.o | |
LIBOBJS_CPP= \ | |
bresenham.o \ | |
bsp.o \ | |
color.o \ | |
console.o \ | |
fov.o \ | |
heightmap.o \ | |
image.o \ | |
lex.o \ | |
mersenne.o \ | |
mouse.o \ | |
noise.o \ | |
parser.o \ | |
path.o \ | |
sys.o \ | |
txtfield.o \ | |
zip.o \ | |
namegen.o | |
GUIOBJS= \ | |
gui/button.o \ | |
gui/container.o \ | |
gui/flatlist.o \ | |
gui/hbox.o \ | |
gui/image.o \ | |
gui/label.o \ | |
gui/radiobutton.o \ | |
gui/slider.o \ | |
gui/statusbar.o \ | |
gui/textbox.o \ | |
gui/togglebutton.o \ | |
gui/toolbar.o \ | |
gui/vbox.o \ | |
gui/widget.o | |
LIBOBJS_C_DEBUG=$(addprefix $(TEMP)/libtcod/debug/, $(LIBOBJS_C)) | |
LIBOBJS_CPP_DEBUG=$(addprefix $(TEMP)/libtcod/debug/, $(LIBOBJS_CPP)) | |
GUIOBJS_DEBUG=$(addprefix $(TEMP)/libtcod/debug/, $(GUIOBJS)) | |
LIBOBJS_C_RELEASE=$(addprefix $(TEMP)/libtcod/release/, $(LIBOBJS_C)) | |
LIBOBJS_CPP_RELEASE=$(addprefix $(TEMP)/libtcod/release/, $(LIBOBJS_CPP)) | |
GUIOBJS_RELEASE=$(addprefix $(TEMP)/libtcod/release/, $(GUIOBJS)) | |
all : debug release | |
debug : libtcod_debug.dylib libtcodxx_debug.dylib libtcodgui_debug.dylib | |
release : libtcod.dylib libtcodxx.dylib libtcodgui.dylib | |
$(TEMP)/libtcod/debug/png : | |
mkdir -p $@ | |
$(TEMP)/libtcod/debug/gui : | |
mkdir -p $@ | |
$(TEMP)/libtcod/release/png : | |
mkdir -p $@ | |
$(TEMP)/libtcod/release/gui : | |
mkdir -p $@ | |
$(TEMP)/libtcod/zlib : | |
@mkdir -p $@ | |
libtcod.a : $(LIBOBJS_C_DEBUG) | |
ar r $@ $(LIBOBJS_C_DEBUG) | |
lib/libz.a : $(TEMP)/libtcod/zlib $(ZLIBOBJS) | |
@ar r $@ $(ZLIBOBJS) | |
libtcodxx.a : $(LIBOBJS_CPP_DEBUG) | |
ar r $@ $(LIBOBJS_CPP_DEBUG) | |
libtcod.dylib : $(TEMP)/libtcod/release/png $(LIBOBJS_C_RELEASE) lib/libz.a | |
@echo Linking $@ | |
@$(CPP) -shared -Wl,-install_name,libtcod.dylib $(LDFLAGS) -o $@ $(LIBOBJS_C_RELEASE) $(OSXCOMPAT) $(LIBS) $(CFLAGS) | |
libtcodxx.dylib : $(TEMP)/libtcod/release/png $(LIBOBJS_CPP_RELEASE) | |
@echo Linking $@ | |
@$(CPP) -shared -Wl,-install_name,libtcodxx.dylib $(LDFLAGS) -o $@ $(LIBOBJS_CPP_RELEASE) $(OSXCOMPAT) -L. -ltcod $(CFLAGS) | |
libtcodgui.dylib : $(TEMP)/libtcod/release/gui $(GUIOBJS_RELEASE) | |
@echo Linking $@ | |
@$(CPP) -shared -Wl,-install_name,libtcodgui.dylib $(LDFLAGS) -o $@ $(GUIOBJS_RELEASE) $(OSXCOMPAT) -L. -ltcod -ltcodxx $(CFLAGS) | |
libtcod_debug.dylib : $(TEMP)/libtcod/debug/png $(LIBOBJS_C_DEBUG) lib/libz.a | |
@echo Linking $@ | |
@$(CPP) -shared -Wl,-install_name,$@ $(LDFLAGS) -o $@ $(LIBOBJS_C_DEBUG) $(OSXCOMPAT) $(LIBS) $(CFLAGS) | |
libtcodxx_debug.dylib : $(TEMP)/libtcod/debug/png $(LIBOBJS_CPP_DEBUG) | |
@echo Linking $@ | |
@$(CPP) -shared -Wl,-install_name,$@ $(LDFLAGS) -o $@ $(LIBOBJS_CPP_DEBUG) $(OSXCOMPAT) -L. -ltcod_debug $(CFLAGS) | |
libtcodgui_debug.dylib : $(TEMP)/libtcod/debug/gui $(GUIOBJS_DEBUG) | |
@echo Linking $@ | |
@$(CPP) -shared -Wl,-install_name,$@ $(LDFLAGS) -o $@ $(GUIOBJS_DEBUG) $(OSXCOMPAT) -L. -ltcod_debug -ltcodxx_debug $(CFLAGS) | |
clean : | |
\rm -f $(LIBOBJS_C_RELEASE) $(LIBOBJS_CPP_RELEASE) $(GUIOBJS_RELEASE) $(LIBOBJS_C_DEBUG) $(LIBOBJS_CPP_DEBUG) $(GUIOBJS_DEBUG) libtcod.a libtcodxx.a libtcod.dylib libtcodxx.dylib libtcodgui.dylib libtcod_debug.dylib libtcodxx_debug.dylib libtcodgui_debug.dylib libtcodpy.pyc | |
cleanall : clean | |
@rm -f $(ZLIBOBJS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment