-
Notifications
You must be signed in to change notification settings - Fork 7
/
makefile
executable file
·65 lines (49 loc) · 1.58 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# build paramaters
CC=gcc
CFLAGS=-std=c99 -pedantic -Wall -g -O -I/usr/local/include -Ilib/libsort -Ilib/librbt
LDFLAGS=/usr/local/lib/liblua.a lib/libsort/libsort.a lib/librbt/librbt.a
LIB=-lsqlite3 -lm
OBJ_DIR=src
DB_DIR=src/db
IC_DIR=src/ic
CM_DIR=src/common
CFLAGS+=-I$(DB_DIR) -I$(IC_DIR) -I$(CM_DIR)
# item script compiler object files
IC_OBJ:=db_search.c rbt_name_range.c rbt_range.c script.c util.c lib/libsort/libsort.a
IC_OBJ:=$(patsubst %.c,$(OBJ_DIR)/%.o,$(IC_OBJ))
# item database loader object files
DB_OBJ:=db_eathena.c db_rathena.c db_resources.c load.c util.c
DB_OBJ:=$(patsubst %.c,$(OBJ_DIR)/%.o,$(DB_OBJ))
TEST_OBJ:=rbt_range.c rbt_name_range.c
TEST_OBJ:=$(patsubst %.c,$(OBJ_DIR)/%.o,$(TEST_OBJ))
# default target compiles the tools
all: ic dbc
lib/libsort/libsort.a:
$(MAKE) -C lib/libsort
lib/librbt/librbt.a:
$(MAKE) -C lib/librbt
ic: $(IC_DIR)/ic.c $(IC_OBJ) lib/librbt/librbt.a
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LIB)
dbc: $(DB_DIR)/db.c $(DB_OBJ) lib/librbt/librbt.a lib/libsort/libsort.a
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LIB)
test: src/test/main.c $(TEST_OBJ) lib/librbt/librbt.a lib/libsort/libsort.a
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LIB)
$(OBJ_DIR)/%.o: $(DB_DIR)/%.c
$(CC) -c -o $@ $(CFLAGS) $^
$(OBJ_DIR)/%.o: $(IC_DIR)/%.c
$(CC) -c -o $@ $(CFLAGS) $^
$(OBJ_DIR)/%.o: $(CM_DIR)/%.c
$(CC) -c -o $@ $(CFLAGS) $^
# clean object files for git inclusion
.PHONY: clean
clean:
rm -rf src/*.o
rm -f ic
rm -f dbc
rm -f test
rm -rf ic.dSYM
rm -rf dbc.dSYM
rm -rf test.dSYM
rm -f .DS_Store
$(MAKE) -C lib/librbt clean
$(MAKE) -C lib/libsort clean