Skip to content

Commit 10ddf94

Browse files
committed
Merge branch 'master' into stable
Conflicts: Makefile src/ext/lpeg/test.lua
2 parents f7de8f0 + 2655416 commit 10ddf94

File tree

6 files changed

+386
-0
lines changed

6 files changed

+386
-0
lines changed

Makefile

Lines changed: 386 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,386 @@
1+
CC=gcc
2+
OPT=-O3 -Wall -std=c99
3+
OPT_PRO=-DTIC80_PRO
4+
BIN_NAME= bin/tic80
5+
6+
RM= rm -f
7+
8+
INCLUDES= \
9+
-Iinclude/lua \
10+
-Iinclude/zlib \
11+
-Iinclude/gif \
12+
-Iinclude/sdl2 \
13+
-Iinclude/tic80
14+
15+
MINGW_LINKER_FLAGS= \
16+
-Llib/mingw \
17+
-lmingw32 \
18+
-lSDL2main \
19+
-lSDL2 \
20+
-lz \
21+
-lgif \
22+
-llua \
23+
-lcomdlg32 \
24+
-lws2_32 \
25+
-mwindows
26+
27+
GTK_INCLUDES= `pkg-config --cflags gtk+-3.0`
28+
GTK_LIBS= `pkg-config --libs gtk+-3.0`
29+
30+
LINUX_INCLUDES= \
31+
$(GTK_INCLUDES) \
32+
`sdl2-config --cflags`
33+
34+
LINUX_LIBS= \
35+
$(GTK_LIBS) \
36+
`sdl2-config --static-libs`
37+
38+
LINUX64_LIBS= \
39+
$(LINUX_LIBS) \
40+
-Llib/linux64
41+
42+
LINUX32_LIBS= \
43+
$(LINUX_LIBS) \
44+
-Llib/linux32
45+
46+
LINUX_ARM_LIBS= \
47+
-Llib/arm
48+
49+
LINUX_LINKER_LTO_FLAGS= \
50+
-D_GNU_SOURCE \
51+
-lSDL2 \
52+
-llua \
53+
-lgif \
54+
-ldl \
55+
-lm \
56+
-lpthread \
57+
-lrt \
58+
-lz
59+
60+
LINUX_LINKER_FLAGS= \
61+
-D_GNU_SOURCE \
62+
-llua5.3 \
63+
-ldl \
64+
-lm \
65+
-lpthread \
66+
-lrt \
67+
-lz
68+
69+
MINGW_OUTPUT=$(BIN_NAME).exe
70+
71+
EMS_CC=emcc
72+
EMS_OPT= \
73+
-D_GNU_SOURCE \
74+
-Wno-typedef-redefinition \
75+
-s USE_SDL=2 \
76+
-s TOTAL_MEMORY=67108864 \
77+
--llvm-lto 1 \
78+
--memory-init-file 0 \
79+
--pre-js lib/emscripten/prejs.js
80+
81+
EMS_LINKER_FLAGS= \
82+
-Llib/emscripten \
83+
-llua \
84+
-lgif \
85+
-lz
86+
87+
MACOSX_OPT= \
88+
-mmacosx-version-min=10.6 \
89+
-Wno-typedef-redefinition \
90+
-D_THREAD_SAFE \
91+
-D_GNU_SOURCE
92+
93+
MACOSX_LIBS= \
94+
-Llib/macos \
95+
-L/usr/local/lib \
96+
-lSDL2 -lm -liconv -lobjc -llua -lz -lgif \
97+
-Wl,-framework,CoreAudio \
98+
-Wl,-framework,AudioToolbox \
99+
-Wl,-framework,ForceFeedback \
100+
-Wl,-framework,CoreVideo \
101+
-Wl,-framework,Cocoa \
102+
-Wl,-framework,Carbon \
103+
-Wl,-framework,IOKit
104+
105+
SOURCES=\
106+
src/studio.c \
107+
src/console.c \
108+
src/run.c \
109+
src/ext/file_dialog.c \
110+
src/ext/md5.c \
111+
src/ext/gif.c \
112+
src/ext/net/SDLnet.c \
113+
src/ext/net/SDLnetTCP.c \
114+
src/ext/net/SDLnetselect.c \
115+
src/fs.c \
116+
src/tools.c \
117+
src/start.c \
118+
src/sprite.c \
119+
src/map.c \
120+
src/sfx.c \
121+
src/music.c \
122+
src/history.c \
123+
src/world.c \
124+
src/config.c \
125+
src/keymap.c \
126+
src/code.c \
127+
src/dialog.c \
128+
src/menu.c \
129+
src/net.c \
130+
src/surf.c
131+
132+
SOURCES_EXT= \
133+
src/html.c
134+
135+
LPEG_SRC= src/ext/lpeg/*.c
136+
GIF_SRC= src/ext/gif/*.c
137+
138+
DEMO_ASSETS= \
139+
bin/assets/fire.tic.dat \
140+
bin/assets/p3d.tic.dat \
141+
bin/assets/palette.tic.dat \
142+
bin/assets/quest.tic.dat \
143+
bin/assets/sfx.tic.dat \
144+
bin/assets/music.tic.dat \
145+
bin/assets/font.tic.dat \
146+
bin/assets/tetris.tic.dat \
147+
bin/assets/jsdemo.tic.dat \
148+
bin/assets/luademo.tic.dat \
149+
bin/assets/moondemo.tic.dat \
150+
bin/assets/benchmark.tic.dat \
151+
bin/assets/config.tic.dat
152+
153+
all: run
154+
155+
TIC80_H = include/tic80/tic80_types.h include/tic80/tic80.h include/tic80/tic80_config.h src/tic.h src/ticapi.h src/machine.h
156+
157+
TIC_H= src/*.h \
158+
src/ext/*.h
159+
160+
bin/studio.o: src/studio.c $(TIC80_H) $(TIC_H)
161+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
162+
163+
bin/console.o: src/console.c $(TIC80_H) $(TIC_H) $(DEMO_ASSETS)
164+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
165+
166+
bin/run.o: src/run.c $(TIC80_H) $(TIC_H)
167+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
168+
169+
bin/file_dialog.o: src/ext/file_dialog.c $(TIC80_H) $(TIC_H)
170+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
171+
172+
bin/md5.o: src/ext/md5.c $(TIC80_H) $(TIC_H)
173+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
174+
175+
bin/gif.o: src/ext/gif.c $(TIC80_H) $(TIC_H)
176+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
177+
178+
bin/SDLnet.o: src/ext/net/SDLnet.c $(TIC80_H) $(TIC_H)
179+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
180+
181+
bin/SDLnetTCP.o: src/ext/net/SDLnetTCP.c $(TIC80_H) $(TIC_H)
182+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
183+
184+
bin/SDLnetselect.o: src/ext/net/SDLnetselect.c $(TIC80_H) $(TIC_H)
185+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
186+
187+
bin/fs.o: src/fs.c $(TIC80_H) $(TIC_H)
188+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
189+
190+
bin/tools.o: src/tools.c $(TIC80_H) $(TIC_H)
191+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
192+
193+
bin/start.o: src/start.c $(TIC80_H) $(TIC_H)
194+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
195+
196+
bin/sprite.o: src/sprite.c $(TIC80_H) $(TIC_H)
197+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
198+
199+
bin/map.o: src/map.c $(TIC80_H) $(TIC_H)
200+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
201+
202+
bin/sfx.o: src/sfx.c $(TIC80_H) $(TIC_H)
203+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
204+
205+
bin/music.o: src/music.c $(TIC80_H) $(TIC_H)
206+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
207+
208+
bin/history.o: src/history.c $(TIC80_H) $(TIC_H)
209+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
210+
211+
bin/world.o: src/world.c $(TIC80_H) $(TIC_H)
212+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
213+
214+
bin/config.o: src/config.c $(TIC80_H) $(TIC_H) $(DEMO_ASSETS)
215+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
216+
217+
bin/keymap.o: src/keymap.c $(TIC80_H) $(TIC_H)
218+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
219+
220+
bin/code.o: src/code.c $(TIC80_H) $(TIC_H)
221+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
222+
223+
bin/net.o: src/net.c $(TIC80_H) $(TIC_H)
224+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
225+
226+
bin/dialog.o: src/dialog.c $(TIC80_H) $(TIC_H)
227+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
228+
229+
bin/menu.o: src/menu.c $(TIC80_H) $(TIC_H)
230+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
231+
232+
bin/surf.o: src/surf.c $(TIC80_H) $(TIC_H)
233+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
234+
235+
TIC_O=\
236+
bin/studio.o \
237+
bin/console.o \
238+
bin/run.o \
239+
bin/file_dialog.o \
240+
bin/md5.o \
241+
bin/gif.o \
242+
bin/SDLnet.o \
243+
bin/SDLnetTCP.o \
244+
bin/SDLnetselect.o \
245+
bin/fs.o \
246+
bin/tools.o \
247+
bin/start.o \
248+
bin/sprite.o \
249+
bin/map.o \
250+
bin/sfx.o \
251+
bin/music.o \
252+
bin/history.o \
253+
bin/world.o \
254+
bin/config.o \
255+
bin/keymap.o \
256+
bin/code.o \
257+
bin/net.o \
258+
bin/dialog.o \
259+
bin/menu.o \
260+
bin/surf.o
261+
262+
bin/tic80.o: src/tic80.c $(TIC80_H)
263+
$(CC) $< $(OPT) $(INCLUDES) -DTIC80_SHARED -c -o $@
264+
265+
bin/tic.o: src/tic.c $(TIC80_H)
266+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
267+
268+
bin/blip_buf.o: src/ext/blip_buf.c $(TIC80_H)
269+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
270+
271+
bin/jsapi.o: src/jsapi.c $(TIC80_H)
272+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
273+
274+
bin/luaapi.o: src/luaapi.c $(TIC80_H)
275+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
276+
277+
bin/duktape.o: src/ext/duktape/duktape.c $(TIC80_H)
278+
$(CC) $< $(OPT) $(INCLUDES) -c -o $@
279+
280+
TIC80_SRC = src/tic80.c src/tic.c src/ext/blip_buf.c src/jsapi.c src/luaapi.c src/ext/duktape/duktape.c
281+
TIC80_O = bin/tic80.o bin/tic.o bin/tools.o bin/blip_buf.o bin/jsapi.o bin/luaapi.o bin/duktape.o bin/gif.o
282+
TIC80_A = bin/libtic80.a
283+
TIC80_DLL = bin/tic80.dll
284+
285+
$(TIC80_DLL): $(TIC80_O)
286+
$(CC) $(OPT) -shared $(TIC80_O) -Llib/mingw -llua -lgif -Wl,--out-implib,$(TIC80_A) -o $@
287+
288+
emscripten:
289+
$(EMS_CC) $(SOURCES) $(TIC80_SRC) $(OPT) $(INCLUDES) $(EMS_OPT) $(EMS_LINKER_FLAGS) -o build/html/tic.js
290+
291+
mingw: $(DEMO_ASSETS) $(TIC80_DLL) $(TIC_O) bin/html.o bin/res.o
292+
$(CC) $(TIC_O) bin/html.o bin/res.o $(TIC80_A) $(OPT) $(INCLUDES) $(MINGW_LINKER_FLAGS) -o $(MINGW_OUTPUT)
293+
294+
mingw-pro:
295+
$(eval OPT += $(OPT_PRO))
296+
make mingw OPT="$(OPT)"
297+
298+
run: mingw-pro
299+
$(MINGW_OUTPUT)
300+
301+
linux64-lto:
302+
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX64_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
303+
304+
linux64-lto-pro:
305+
$(eval OPT += $(OPT_PRO))
306+
make linux64-lto OPT="$(OPT)"
307+
308+
linux32-lto:
309+
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) $(INCLUDES) $(LINUX32_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
310+
311+
linux32-lto-pro:
312+
$(eval OPT += $(OPT_PRO))
313+
make linux32-lto OPT="$(OPT)"
314+
315+
chip-lto:
316+
$(CC) $(LINUX_INCLUDES) $(GTK_INCLUDES) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) $(OPT) -D__CHIP__ $(INCLUDES) $(LINUX_ARM_LIBS) $(GTK_LIBS) $(LINUX_LINKER_LTO_FLAGS) -flto -o $(BIN_NAME)
317+
318+
chip-lto-pro:
319+
$(eval OPT += $(OPT_PRO))
320+
make chip-lto OPT="$(OPT)"
321+
322+
linux:
323+
$(CC) $(LINUX_INCLUDES) $(SOURCES) $(LPEG_SRC) $(GIF_SRC) $(SOURCES_EXT) $(TIC80_SRC) $(OPT) $(INCLUDES) $(LINUX_LIBS) $(LINUX_LINKER_FLAGS) -o $(BIN_NAME)
324+
325+
linux-pro:
326+
$(eval OPT += $(OPT_PRO))
327+
make linux OPT="$(OPT)"
328+
329+
macosx:
330+
$(CC) $(SOURCES) $(TIC80_SRC) $(SOURCES_EXT) src/ext/file_dialog.m $(OPT) $(MACOSX_OPT) $(INCLUDES) $(MACOSX_LIBS) -o $(BIN_NAME)
331+
332+
macosx-pro:
333+
$(eval OPT += $(OPT_PRO))
334+
make macosx OPT="$(OPT)"
335+
336+
bin/res.o: lib/mingw/res.rc lib/mingw/icon.ico
337+
windres $< $@
338+
339+
BIN2TXT= tools/bin2txt/bin2txt
340+
341+
bin/html.o: src/html.c build/html/index.html build/html/tic.js
342+
$(BIN2TXT) build/html/index.html bin/assets/index.html.dat -z
343+
$(BIN2TXT) build/html/tic.js bin/assets/tic.js.dat -z
344+
$(CC) -c src/html.c $(OPT) $(INCLUDES) -o $@
345+
346+
bin/assets/config.tic.dat: config.tic
347+
$(BIN2TXT) $< $@ -z
348+
349+
bin/assets/fire.tic.dat: demos/fire.tic
350+
$(BIN2TXT) $< $@ -z
351+
352+
bin/assets/p3d.tic.dat: demos/p3d.tic
353+
$(BIN2TXT) $< $@ -z
354+
355+
bin/assets/palette.tic.dat: demos/palette.tic
356+
$(BIN2TXT) $< $@ -z
357+
358+
bin/assets/quest.tic.dat: demos/quest.tic
359+
$(BIN2TXT) $< $@ -z
360+
361+
bin/assets/sfx.tic.dat: demos/sfx.tic
362+
$(BIN2TXT) $< $@ -z
363+
364+
bin/assets/font.tic.dat: demos/font.tic
365+
$(BIN2TXT) $< $@ -z
366+
367+
bin/assets/music.tic.dat: demos/music.tic
368+
$(BIN2TXT) $< $@ -z
369+
370+
bin/assets/tetris.tic.dat: demos/tetris.tic
371+
$(BIN2TXT) $< $@ -z
372+
373+
bin/assets/jsdemo.tic.dat: demos/jsdemo.tic
374+
$(BIN2TXT) $< $@ -z
375+
376+
bin/assets/luademo.tic.dat: demos/luademo.tic
377+
$(BIN2TXT) $< $@ -z
378+
379+
bin/assets/moondemo.tic.dat: demos/moondemo.tic
380+
$(BIN2TXT) $< $@ -z
381+
382+
bin/assets/benchmark.tic.dat: demos/benchmark.tic
383+
$(BIN2TXT) $< $@ -z
384+
385+
clean: $(TIC_O) $(TIC80_O)
386+
del bin\*.o

build/macosx/ticIcon.png

-17 KB
Binary file not shown.

lib/linux/libSDL2.a

-9.3 MB
Binary file not shown.

lib/linux/libgif.a

-59.7 KB
Binary file not shown.

lib/linux/liblua.a

-486 KB
Binary file not shown.

lib/linux/libz.a

-143 KB
Binary file not shown.

0 commit comments

Comments
 (0)