forked from pmwkaa/sophia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
62 lines (56 loc) · 1.5 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
# sophia makefile
#
CC ?= cc
ifdef ENABLE_COVERAGE
CFLAGS_COVERAGE = --coverage
else
CFLAGS_COVERAGE =
endif
CFLAGS_DEBUG = -DSS_INJECTION_ENABLE -g
CFLAGS_OPT = -O2
CFLAGS_STRICT = -std=c99 -pedantic -Wextra -Wall
CFLAGS_MISC = -Wno-unused-function -fPIC -fno-stack-protector -fvisibility=hidden
SOPHIA_CFLAGS = $(CFLAGS_DEBUG) \
$(CFLAGS_OPT) \
$(CFLAGS_STRICT) \
$(CFLAGS_COVERAGE) \
$(CFLAGS_MISC) \
$(CFLAGS)
SOPHIA_LDFLAGS = -shared $(LDFLAGS)
all: static dynamic
banner:
@echo SOPHIA v2.1.1
@echo "cc: $(CC)"
@echo "cflags: $(CFLAGS_DEBUG) $(CFLAGS_COVERAGE)$(CFLAGS_OPT) $(CFLAGS_STRICT)"
@echo
sophia.c:
@echo build
@sh sophia/build sophia $@
@echo cc $@
sophia.h:
@cp sophia/sophia/sophia.h .
sophia.o: banner clean sophia.c sophia.h
@$(CC) $(SOPHIA_CFLAGS) -c sophia.c -o sophia.o
libsophia.a: sophia.o
@echo "ar libsophia.a"
@ar crs libsophia.a sophia.o
libsophia.so: sophia.o
@echo "ld libsophia.so"
@$(CC) sophia.o $(SOPHIA_LDFLAGS) -o libsophia.so.2.1.1
@ln -sf libsophia.so.2.1.1 libsophia.so.2.1
@ln -sf libsophia.so.2.1.1 libsophia.so
ifeq ($(shell uname), Linux)
@strip --strip-unneeded libsophia.so.2.1.1
endif
ifeq ($(shell uname), Darwin)
@strip -u -r -x libsophia.so.2.1.1
endif
static: libsophia.a
dynamic: libsophia.so
clean:
@rm -f sophia.c sophia.h sophia.o
@rm -f libsophia.a
@rm -f libsophia.so
@rm -f libsophia.so.2.1
@rm -f libsophia.so.2.1.1
.PHONY: all banner static dynamic clean