-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 1.06 KB
/
Makefile
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
ifeq ($(shell uname -s),)
TARGET=ddlt.dll
else ifneq ($(findstring MINGW,$(shell uname -a)),)
TARGET=ddlt.dll
else ifneq ($(findstring MSYS,$(shell uname -a)),)
TARGET=ddlt.dll
else ifneq ($(findstring win,$(shell uname -a)),)
TARGET=ddlt.dll
else ifneq ($(findstring Darwin,$(shell uname -a)),)
TARGET=ddlt.dylib
else
TARGET=ddlt.so
endif
%.o: %.c
gcc -Isrc -O2 -Werror -Wall -Wpedantic -fPIC $(CFLAGS) `pkg-config lua5.3 --cflags` -c $< -o $@
all: $(TARGET)
$(TARGET): src/ddlt.o src/lexer.o src/path.o src/templ.o
gcc -shared -fPIC -o $@ $+ -lm $(LDFLAGS) `pkg-config lua5.3 --libs`
src/ddlt.o: src/ddlt.c src/lexer.h src/path.h src/templ.h src/boot_lua.h
src/lexer.o: src/lexer.c src/lexer.h src/lexer_cpp.c src/lexer_bas.c src/lexer_pas.c
src/path.o: src/path.c src/path.h src/realpath.c
src/templ.o: src/templ.c src/templ.h
src/boot_lua.h: src/boot.lua
echo "static char const `basename "$<" | sed 's/\./_/'`[] = {`cat "$<" | xxd -i`};" > "$@"
clean:
rm -f $(TARGET) src/ddlt.o src/lexer.o src/path.o src/templ.o src/boot_lua.h
.PHONY: clean