-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (41 loc) · 1.34 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
# Paths
ROOT ?=
DEFUSRBIN ?= /usr/bin/
DEFSBIN ?= /sbin/
MANDIR ?= /usr/share/man/
STATIC_LIBDIR ?= /usr/lib/
# Programs
CC ?= gcc
AR ?= ar
INSTALL ?= /bin/install
# Flags
LDFLAGS ?= -static
LIBS ?= -L/usr/lib -lc
all: libssp-nonshared getconf getent iconv
getconf: getconf.o
$(LD) $(LDFLAGS) $(LIBS) getconf.o -o getconf
getconf.o: cmd/getconf.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c ./cmd/getconf.c
getent: getent.o
$(LD) $(LDFLAGS) $(LIBS) getent.o -o getent
getent.o: cmd/getent.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c ./cmd/getent.c
iconv: iconv.o
$(LD) $(LDFLAGS) $(LIBS) iconv.o -o iconv
iconv.o: cmd/iconv.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c ./cmd/iconv.c
libssp-nonshared: __stack_chk_fail_local.o
$(AR) r libssp_nonshared.a ./__stack_chk_fail_local.o
__stack_chk_fail_local.o: lib/__stack_chk_fail_local.c
$(CC) -fpie -c ./lib/__stack_chk_fail_local.c -o __stack_chk_fail_local.o
install: install-libssp install-progs
install-progs: getconf getent iconv cmd/ldconfig
for program in getconf getent iconv ; do \
$(INSTALL) -c -m 755 $$program $(ROOT)$(DEFUSRBIN) ; \
$(INSTALL) -c -m 644 ./man/$$program.1 $(ROOT)$(MANDIR)/man1/ ; \
done
$(INSTALL) -c -m 755 cmd/ldconfig $(ROOT)$(DEFSBIN)
install-libssp: libssp-nonshared
$(INSTALL) -c -m 664 ./libssp_nonshared.a $(ROOT)$(STATIC_LIBDIR)
clean:
rm -f *.o *.a getconf getent iconv *~