/
makefile.osx
81 lines (63 loc) · 2.97 KB
/
makefile.osx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
OUTPUT_APP=Awesome
ICON=media/graphics/ExplatTheRobot.icns
OUTPUT_EXE=game.exe
MAKE=make
# You shouldn't have to edit anything below this line
VERSION_TARGET=10.2
FRAMEWORKS=functioning/OSX/Frameworks
CPPFLAGS=-I/usr/local/include -I${FRAMEWORKS}/SDL.framework/Versions/Current/Headers -I${FRAMEWORKS}/SDL_net.framework/Versions/Current/Headers -I${FRAMEWORKS}/SDL_mixer.framework/Versions/Current/Headers -I${FRAMEWORKS}/SDL_image.framework/Versions/Current/Headers -D_THREAD_SAFE -DOSX
LIBS=-L/usr/lib
DEBUG_MLTON_FLAGS=#-const 'Exn.keepHistory true'
MLTON_FLAGS=$(DEBUG_MLTON_FLAGS) -verbose 1 -cc-opt "-g -Dmain=SDL_main" -link-opt "-Wl,-rpath,@executable_path/../Frameworks -F${FRAMEWORKS} -framework SDL_net -framework SDL_image ${LIBS} -framework SDL -framework OpenGL -framework AGL -framework IOKit -framework Carbon -framework Cocoa -framework SDL_mixer" -default-ann 'allowFFI true'
RELEASEFILES=$(OUTPUT_EXE) media COPYING
default: game
bin:
mkdir bin
bin/sdlmain.o: bin sdlml/sdlmain.m sdlml/sdlmain.h
gcc -O $(CPPFLAGS) -c sdlml/sdlmain.m -o bin/sdlmain.o
bin/sdlml.o: bin sdlml/sdlml.c
gcc -O $(CPPFLAGS) -c sdlml/sdlml.c -o bin/sdlml.o
bin/sdlmix.o: bin sdlml/sdlmix.c
gcc -O $(CPPFLAGS) -c sdlml/sdlmix.c -o bin/sdlmix.o
.PHONY: game
game: bin/sdlml.o bin/sdlmix.o bin/sdlmain.o
export MACOSX_DEPLOYMENT_TARGET=${VERSION_TARGET}
mlton $(MLTON_FLAGS) -output $(OUTPUT_EXE) game.cm bin/sdlml.o bin/sdlmix.o bin/sdlmain.o
$(MAKE) desktop
.PHONY: examples/* examples/*/
examples/*:
$(MAKE) $@/
examples/*/: bin/sdlml.o bin/sdlmix.o bin/sdlmain.o
export MACOSX_DEPLOYMENT_TARGET=${VERSION_TARGET}
mlton $(MLTON_FLAGS) -output $(OUTPUT_EXE) $@sources.cm bin/sdlml.o bin/sdlmix.o bin/sdlmain.o
$(MAKE) desktop
.PHONY:app
app:
rm -rf /tmp/Func.app
# Start by making a Func.app directory, put OSX basics in it
mkdir -p /tmp/Func.app
cp -R functioning/OSX /tmp/Func.app/Contents # Frameworks, PkgInfo
functioning/plistgen.sh $(OUTPUT_EXE) $(OUTPUT_APP) #Info.plist
# The resources directory just contains the icon
mkdir -p /tmp/Func.app/Contents/Resources
cp $(ICON) /tmp/Func.app/Contents/Resources/$(OUTPUT_APP).icns
# The MacOS directory contains all the interesting application goodies
mkdir -p /tmp/Func.app/Contents/MacOS
cp -R ${RELEASEFILES} /tmp/Func.app/Contents/MacOS/
# Cleanup
rm -f /tmp/Func.app/Contents/Frameworks/SDL.framework/Headers/*.h
rm -f /tmp/Func.app/Contents/Frameworks/SDL_image.framework/Headers/*.h
rm -f /tmp/Func.app/Contents/Frameworks/SDL_net.framework/Headers/*.h
rm -f /tmp/Func.app/Contents/MacOS/OSX_build/SDL_mixer.framework/Headers/*.h
rm -rf `find /tmp/Func.app -name CVS`
rm -rf `find /tmp/Func.app -name .DS_Store`
rm -rf `find /tmp/Func.app -name .svn`
rm -rf `find /tmp/Func.app -name *.ogg`
.PHONY: desktop
desktop: app
rm -rf ~/Desktop/$(OUTPUT_APP).app.old
-mv ~/Desktop/$(OUTPUT_APP).app ~/Desktop/$(OUTPUT_APP).app.old
cp -R /tmp/Func.app ~/Desktop/$(OUTPUT_APP).app
.PHONY: clean
clean:
rm -f core core.* *~ *.exe bin/*