-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (35 loc) · 1.15 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
38
39
40
41
42
43
44
45
LUADIR=/media/supra/Fichiers/Travail/EISD/lua-5.3.5
LUABIN=${LUADIR}/bin
LUAINC=${LUADIR}/include
LUALIB=${LUADIR}/lib
CFLAGS =-std=c99 -W -Wall -O3
LIBS =-llua -lm -ldl
INCDIR =-I${LUAINC}
LIBDIR =-L${LUALIB}
DESTDIR=
PREFIX =/usr/local
INSTALL= install -p
INSTALL_EXEC= $(INSTALL) -m 0755
dark: src/dark.c src/dark.inc
@echo "CC: dark.c --> dark"
@$(CC) -DNDEBUG $(CFLAGS) $(INCDIR) $(LIBDIR) -o dark src/dark.c $(LIBS)
debug: src/dark.c src/dark.inc
@echo "CC: dark.c --> dark"
@$(CC) -g $(CFLAGS) $(INCDIR) $(LIBDIR) -o dark src/dark.c $(LIBS)
src/dark.inc: src/dark.lua
@echo "PP: dark.lua --> dark.inc"
@echo "static const char dark_dat[] = {" > src/dark.inc
@${LUABIN}/luac -o - src/dark.lua | od -v -t x1 | \
sed 's/^[0-9]* *//;s/\([0-9a-f][0-9a-f]\)/0x\1,/g;s/ */ /g' \
>> src/dark.inc
@echo "};" >> src/dark.inc
@echo "static const size_t dark_len = sizeof(dark_dat);" >> src/dark.inc
install: dark
@echo "CP: dark --> $(DESTDIR)$(PREFIX)/bin"
@mkdir -p $(DESTDIR)$(PREFIX)/bin
@$(INSTALL_EXEC) dark $(DESTDIR)$(PREFIX)/bin
clean:
@echo "RM: dark"
@rm -f dark
@rm -f src/dark.inc
.PHONY: clean install