-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (35 loc) · 1.28 KB
/
Makefile
File metadata and controls
50 lines (35 loc) · 1.28 KB
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
OBJ := $(addprefix build/, dfile.o dprintf.o dragonbox.o fast_float.o dsanity.o dscanf.o)
WIN_OBJ := $(OBJ:.o=.exe.o)
EM_OBJ := $(OBJ:.o=.em.o)
DEP := $(OBJ:.o=.d) $(WIN_OBJ:.o=.d) $(EM_OBJ:.o=.d)
.PHONY: clean all
CFLAGS += -Iinclude -g
libdfile.so : $(OBJ)
gcc -shared -o $@ $^
build/%.o : src/%.c
@mkdir -p $(dir $@)
gcc -c -o $@ $< -fPIC -MMD -MP $(CFLAGS)
build/%.o : src/%.cpp
@mkdir -p $(dir $@)
gcc -c -o $@ $< -fPIC -MMD -MP -fvisibility=hidden -Os $(CFLAGS)
# Remember: DFILE is LGPL, so if you statically link, your software has to be GPL or you have to linkable object files
#libemdfile.a : $(EM_OBJ)
# emar rcs $@ $^
build/%.em.o : src/%.c
@mkdir -p $(dir $@)
emcc -Wno-gnu -c -o $@ $< -MMD -MP $(CFLAGS)
build/%.em.o : src/%.cpp
@mkdir -p $(dir $@)
emcc -c -o $@ $< -MMD -MP -Os $(CFLAGS)
dfile.dll : $(WIN_OBJ)
/usr/bin/x86_64-w64-mingw32-gcc -shared -o $@ $^ -lgcc_eh
build/%.exe.o : src/%.c
@mkdir -p $(dir $@)
/usr/bin/x86_64-w64-mingw32-gcc -c -o $@ $< -MMD -MP $(CFLAGS)
build/%.exe.o : src/%.cpp
@mkdir -p $(dir $@)
/usr/bin/x86_64-w64-mingw32-gcc -c -o $@ $< -fno-exceptions -MMD -MP -fvisibility=hidden -Os $(CFLAGS)
all : libdfile.so dfile.dll
clean :
-\rm -f $(OBJ) $(WIN_OBJ) $(EM_OBJ) dfile.dll libdfile.so libemdfile.a a.out a.exe $(DEP)
-include $(DEP)