-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tupfile
55 lines (36 loc) · 1.06 KB
/
Tupfile
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
CFLAGS = -I /usr/local/include -I ./include -Wall -Wno-unused
ifeq (@(RELEASE),y)
CFLAGS += -Os
else
CFLAGS += -g
endif
# Source files of splix
SRC_FILES = src/slre.c
SRC_FILES += src/ses.c
SRC_FILES += src/parg.c
MAIN_FILE = src/splix.c
EXPAT_LIBS = -lexpat
SPLIX_LIBS = $(EXPAT_LIBS)
LDFLAGS = $(SPLIX_LIBS)
LD_STATIC_FLAGS = -static $(LDFLAGS)
!cc = |> ^ CC %f ^ gcc $(CFLAGS) -c %f -o %o |>
!ld = |> gcc %f $(LDFLAGS) -o %o |>
!ld_static = |> gcc %f $(LD_STATIC_FLAGS) -o %o |>
ifdef TARGET_ARCH
TARGET_ARCH=@(TARGET_ARCH)
else
TARGET_ARCH=x86_64
endif
BUILD_PATH = build/$(TARGET_ARCH)
ifeq ($(TARGET_ARCH),i386)
CFLAGS += -m32
LDFLAGS += -m32
LD_STATIC_FLAGS += -m32
endif
: foreach $(SRC_FILES) |> !cc |> $(BUILD_PATH)/obj/%B.o {objects}
: $(MAIN_FILE) |> !cc |> $(BUILD_PATH)/obj/%B.o {main}
: {objects} {main} |> !ld |> $(BUILD_PATH)/bin/splix {bin}
: {objects} {main} |> !ld_static |> $(BUILD_PATH)/bin/splix_static {bin_static}
: {bin} |> cp %f %o |> bin/%B.$(TARGET_ARCH)
: {bin_static} |> cp %f %o |> bin/%B.$(TARGET_ARCH)
# ^ LINK %f ^