-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.bsd
72 lines (50 loc) · 1.58 KB
/
Makefile.bsd
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
66
67
68
69
70
71
72
CFLAGS = -O2 -Wall -Wextra -std=c99 -pedantic
LDFLAGS ?=
DESTDIR ?= ${_destdir}
INSTALL ?= ${_install}
RM ?= rm -rf
DEFS = -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
DEFS += -I../include ${_defs}
TARGETS = eav eav.static
SOURCES != ls *.c
OBJECTS = ${SOURCES:.c=.o}
LIBS = -L.. -leav ${_libs}
LIBS_STATIC = -L.. -leav ${_libs_static}
#----------------------------------------------------------#
CPPFLAGS += ${DEFS}
all: shared
debug: DEFS += -g -D_DEBUG
debug: all
static: eav.static
shared: eav
eav: ${OBJECTS}
# bin -> shared linkage
${CC} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
eav.static: ${OBJECTS}
# bin -> static linkage
${CC} -static -o $@ ${OBJECTS} ${LIBS_STATIC}
.c.o:
${CC} ${CPPFLAGS} ${DEFS} ${INCLUDES} ${CFLAGS} -o $@ -c $<
strip: shared
# bin -> strip shared
strip --strip-unneeded -R .comment -R .note -R .note.ABI-tag eav
strip-static: static
# bin -> strip static
strip --strip-unneeded -R .comment -R .note -R .note.ABI-tag eav.static
#----------------------------------------------------------#
clean:
# bin -> cleanup
${RM} ${TARGETS} ${OBJECTS}
#----------------------------------------------------------#
install: shared
${INSTALL} -d ${DESTDIR}/bin
${INSTALL} -m 0755 eav ${DESTDIR}/bin
install-static: static
${INSTALL} -d ${DESTDIR}/sbin
${INSTALL} -m 0755 eav.static ${DESTDIR}/sbin/eav-static
uninstall:
# === bin -> uninstalling ...
${RM} ${DESTDIR}/bin/eav
${RM} ${DESTDIR}/sbin/eav-static
#----------------------------------------------------------#
.PHONY: all clean debug install strip static shared install-static strip-static eav eav.static uninstall