-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathMakefile.linux
268 lines (225 loc) · 7.01 KB
/
Makefile.linux
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
THIRDPARTY = 3rdparty
PLUGINS = plugins
MUJS = $(THIRDPARTY)/mujs-1.0.5
ALLEGRO = $(THIRDPARTY)/allegro-4.3.3.1
KUBAZIP = $(THIRDPARTY)/zip-0.3.2
INI = $(THIRDPARTY)/ini-20220806/src
WEBP = $(THIRDPARTY)/libwebp-1.3.2
LIB_MUJS = $(MUJS)/build/release/libmujs.a
LIB_ALLEGRO = $(ALLEGRO)/build/lib/liballeg.a
LIB_WEBP = $(WEBP)/src/libwebp.a
# compiler
SQLITE_CFLAGS = \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_DEFAULT_MEMSTATUS=0 \
-DSQLITE_MAX_MMAP_SIZE=0 \
-DSQLITE_OMIT_WAL=1 \
-DSQLITE_OMIT_LOAD_EXTENSION=1 \
-DSQLITE_ENABLE_8_3_NAMES=2 \
-DSQLITE_ENABLE_LOCKING_STYLE=0
CDEF = -DLINUX=1 -D__LINUX__ -DUSE_MESA=1 -DUSE_GLUT=1 $(SQLITE_CFLAGS) -DGC_BEFORE_MALLOC #-DDEBUG_ENABLED #-DEDI_FAST # -DMEMDEBUG
CFLAGS = -MMD -Wall -Wno-format -std=gnu99 -O2 -fomit-frame-pointer $(INCLUDES) -fgnu89-inline -Wmissing-prototypes $(CDEF)
INCLUDES = \
-I$(realpath ./src) \
-I$(realpath ./src/linux) \
-I$(realpath $(PLUGINS))/jpeg.dxelib \
-I$(realpath $(PLUGINS))/curl.dxelib \
-I$(realpath $(PLUGINS))/qoi.dxelib \
-I$(realpath $(PLUGINS))/webp.dxelib \
-I$(realpath $(PLUGINS))/sqlite.dxelib \
-I$(realpath $(PLUGINS))/neural.dxelib \
-I$(realpath $(PLUGINS))/noise.dxelib \
-I$(realpath $(PLUGINS))/noise.dxelib/src \
-I$(realpath $(PLUGINS))/nanosvg.dxelib \
-I$(realpath $(PLUGINS))/mpeg1.dxelib \
-I$(realpath $(PLUGINS))/genpdf.dxelib \
-I$(realpath $(PLUGINS))/genpdf.dxelib/PDFGen-master/ \
-I$(realpath $(PLUGINS))/vorbis.dxelib \
-I$(realpath $(PLUGINS))/gifanim.dxelib \
-I$(realpath $(PLUGINS))/ogl.dxelib \
-I$(realpath $(MUJS)) \
-I$(realpath $(ALLEGRO))/include \
-I$(realpath $(ALLEGRO))/build/include \
-I$(realpath $(ALLEGRO))/addons/loadpng \
-I$(realpath $(ALLEGRO))/addons/jpgalleg/include \
-I$(realpath $(KUBAZIP))/src \
-I$(realpath $(KUBAZIP))/src/linux \
-I$(realpath $(WEBP))/src \
-I$(realpath $(INI))/
# linker
LIBS = -lalleg -lloadpng -ljpeg -lmujs -lm -lz -lpthread -lm -lpthread -lrt -lXpm -lX11 -lXext -lXxf86vm -lXcursor -lXcursor -lasound -lpng -lcurl -lGL -lGLU -lglut -lGLEW -lglfw -lwebp -lsharpyuv
LDFLAGS = -s \
-L$(MUJS)/build/release \
-L$(WEBP)/src \
-L$(WEBP)/sharpyuv \
-L$(ALLEGRO)/build/lib
# output
EXE = dojs
RELZIP = Linux_dojs-X.Y.Z.zip
# dirs/files
DOJSPATH = $(realpath .)
BUILDDIR = build_linux
DOCDIR = doc/html
CROSS=
CROSS_PLATFORM=
CC=$(CROSS_PLATFORM)gcc
CXX=$(CROSS_PLATFORM)g++
AR=$(CROSS_PLATFORM)ar
LD=$(CROSS_PLATFORM)ld
STRIP=$(CROSS_PLATFORM)strip
RANLIB=$(CROSS_PLATFORM)ranlib
export
PARTS= \
$(BUILDDIR)/linux/conio.o \
$(BUILDDIR)/linux/glue.o \
$(BUILDDIR)/blurhash.o \
$(BUILDDIR)/blender.o \
$(BUILDDIR)/bytearray.o \
$(BUILDDIR)/intarray.o \
$(BUILDDIR)/bitmap.o \
$(BUILDDIR)/color.o \
$(BUILDDIR)/dialog.o \
$(BUILDDIR)/DOjS.o \
$(BUILDDIR)/edi_render.o \
$(BUILDDIR)/edit.o \
$(BUILDDIR)/file.o \
$(BUILDDIR)/font.o \
$(BUILDDIR)/flic.o \
$(BUILDDIR)/funcs.o \
$(BUILDDIR)/gfx.o \
$(BUILDDIR)/inifile.o \
$(BUILDDIR)/joystick.o \
$(BUILDDIR)/lines.o \
$(BUILDDIR)/midiplay.o \
$(BUILDDIR)/sound.o \
$(BUILDDIR)/syntax.o \
$(BUILDDIR)/util.o \
$(BUILDDIR)/zip/src/zip.o \
$(BUILDDIR)/zipfile.o \
$(BUILDDIR)/ini/ini.o \
$(BUILDDIR)/curl.o \
$(BUILDDIR)/qoi.o \
$(BUILDDIR)/jpeg.o \
$(BUILDDIR)/webp.o \
$(BUILDDIR)/sqlite.o \
$(BUILDDIR)/sqlite3.o \
$(BUILDDIR)/noise.o \
$(BUILDDIR)/noise1234.o \
$(BUILDDIR)/simplexnoise1234.o \
$(BUILDDIR)/neural.o \
$(BUILDDIR)/perm.o \
$(BUILDDIR)/genann.o \
$(BUILDDIR)/doublearray.o \
$(BUILDDIR)/nanosvg.o \
$(BUILDDIR)/mpeg1.o \
$(BUILDDIR)/genpdf.o \
$(BUILDDIR)/PDFGen-master/pdfgen.o \
$(BUILDDIR)/vorbis.o \
$(BUILDDIR)/stb_vorbis.o \
$(BUILDDIR)/gifanim.o \
$(BUILDDIR)/watt.o \
$(BUILDDIR)/ogl.o \
$(BUILDDIR)/ogl_const.o \
$(BUILDDIR)/socket.o
all: init $(EXE) JSBOOT.ZIP cacert.pem
libmujs: $(LIB_MUJS)
$(LIB_MUJS):
$(MAKE) $(MPARA) -C $(MUJS) build/release/libmujs.a LINUX=1
liballegro: $(LIB_ALLEGRO)
$(LIB_ALLEGRO):
(mkdir -p $(ALLEGRO)/build && \
cd $(ALLEGRO)/build && \
cmake \
-DWANT_LINUX_CONSOLE=off \
-DWANT_LINUX_VGA=off \
-DWANT_LINUX_FBCON=off \
-DWANT_LINUX_SVGALIB=off \
-DWANT_X11=on \
-DSHARED=off \
-DWANT_MODULES=off \
-DWANT_ALSA=on \
-DWANT_JACK=off \
-DWANT_OSS=off \
-DWANT_SGIAUDIO=off \
-DWANT_ALLEGROGL=off \
-DWANT_LOADPNG=on \
-DWANT_LOGG=off \
-DWANT_JPGALLEG=off \
-DWANT_EXAMPLES=off \
-DWANT_TOOLS=off \
-DWANT_TESTS=off \
.. && \
make -j 8 allegro loadpng)
libwebp: $(LIB_WEBP)
$(LIB_WEBP):
$(MAKE) $(MPARA) -C $(WEBP) -f makefile.unix src/libwebp.a sharpyuv/libsharpyuv.a
$(EXE): init libwebp libmujs liballegro $(PARTS)
$(CC) $(LDFLAGS) -o $@ $(PARTS) $(LIBS)
$(BUILDDIR)/%.o: src/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/sqlite.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/jpeg.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/qoi.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/webp.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/curl.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/noise.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/noise.dxelib/src/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/neural.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/nanosvg.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/mpeg1.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/genpdf.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/vorbis.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/gifanim.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o: plugins/ogl.dxelib/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/zip/src/%.o: $(KUBAZIP)/src/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/ini/%.o: $(INI)/%.c Makefile
$(CC) $(CFLAGS) -c $< -o $@
JSBOOT.ZIP: $(shell find jsboot/ -type f)
rm -f $@
zip -9 -r $@ jsboot/
cacert.pem:
curl --remote-name --time-cond cacert.pem https://curl.se/ca/cacert.pem
zip: all cacert.pem doc
rm -f $(RELZIP)
zip -9 -r $(RELZIP) $(EXE) dojs.ini LICENSE *.md JSBOOT.ZIP examples/ $(DOCDIR) cacert.pem
doc:
rm -rf $(DOCDIR)
mkdir -p $(DOCDIR)
cd doc && jsdoc --verbose -c jsdoc.conf.json -d ../$(DOCDIR)
init:
mkdir -p $(BUILDDIR) $(BUILDDIR)/zip/src $(BUILDDIR)/ini $(BUILDDIR)/linux $(BUILDDIR)/PDFGen-master/
# make sure compile time is always updated
# rm -f $(BUILDDIR)/DOjS.o
clean:
rm -rf $(BUILDDIR)/
rm -f $(EXE) $(ZIP) JSLOG.TXT JSBOOT.ZIP cacert.pem
jsclean:
$(MAKE) -C $(MUJS) clean
alclean:
rm -rf $(ALLEGRO)/build
webpclean:
$(MAKE) -C $(WEBP) -f makefile.unix clean
distclean: clean alclean jsclean webpclean
rm -rf $(DOCDIR) TEST.TXT JSLOG.TXT synC.txt synJ.txt syn.txt *.DXE *.BMP *.PCX, *.TGA *.PNG TMP1.* TMP2.*
linuxtest: linuxtest.c
$(CC) $(CFLAGS) $< -o linuxtest
.PHONY: distclean clean init doc zip alclean jsclean
DEPS := $(wildcard $(BUILDDIR)/*.d)
ifneq ($(DEPS),)
include $(DEPS)
endif