-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
92 lines (71 loc) · 2.53 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#
# This Makefile requires GNU make.
#
# Do not make changes here.
# Use the included .mak files.
#
it: all
make_need := 3.81
ifeq "" "$(strip $(filter $(make_need), $(firstword $(sort $(make_need) $(MAKE_VERSION)))))"
fail := $(error Your make ($(MAKE_VERSION)) is too old. You need $(make_need) or newer)
endif
CC = $(error Please use ./configure first)
STATIC_LIBS :=
SHARED_LIBS :=
INTERNAL_LIBS :=
LIB_DEFS :=
-include config.mak
include package/targets.mak
$(foreach var,$(LIB_DEFS),$(eval $(call library_definition,$(var))))
include package/deps.mak
version_m := $(basename $(version))
version_M := $(basename $(version_m))
version_l := $(basename $(version_M))
CPPFLAGS_ALL := $(CPPFLAGS_AUTO) $(CPPFLAGS)
CFLAGS_ALL := $(CFLAGS_AUTO) $(CFLAGS)
ifeq ($(strip $(STATIC_LIBS_ARE_PIC)),)
CFLAGS_SHARED := -fPIC
else
CFLAGS_SHARED :=
endif
LDFLAGS_ALL := $(LDFLAGS_AUTO) $(LDFLAGS)
REALCC = $(CROSS_COMPILE)$(CC)
AR := $(CROSS_COMPILE)ar
RANLIB := $(CROSS_COMPILE)ranlib
STRIP := $(CROSS_COMPILE)strip
INSTALL := ./tools/install.sh
ALL_BINS := $(LIBEXEC_TARGETS) $(BIN_TARGETS)
all: $(ALL_BINS)
clean:
@exec rm -f $(ALL_BINS) $(wildcard src/*/*.o src/*/*.lo) $(EXTRA_TARGETS)
distclean: clean
@exec rm -f config.mak
tgz: distclean
@. package/info && \
rm -rf /tmp/$$package-$$version && \
cp -a . /tmp/$$package-$$version && \
cd /tmp && \
tar -zpcv --owner=0 --group=0 --numeric-owner --exclude=.travis* --exclude=dist --exclude=tools/cross --exclude=tools/downloads --exclude=tools/travis* --exclude=tools/keys* --exclude=.git* -f /tmp/$$package-$$version.tar.gz $$package-$$version && \
exec rm -rf /tmp/$$package-$$version
strip: $(ALL_LIBS) $(ALL_BINS)
ifneq ($(strip $(STATIC_LIBS)),)
exec $(STRIP) -x -R .note -R .comment -R .note.GNU-stack $(STATIC_LIBS)
endif
ifneq ($(strip $(ALL_BINS)$(SHARED_LIBS)),)
exec $(STRIP) -R .note -R .comment -R .note.GNU-stack $(ALL_BINS) $(SHARED_LIBS)
endif
install: install-bin
install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%)
$(DESTDIR)$(libexecdir)/% $(DESTDIR)$(bindir)/%: % package/modes
exec $(INSTALL) -D -m 600 $< $@
grep -- ^$(@F) < package/modes | { read name mode owner && \
if [ x$$owner != x ] ; then chown -- $$owner $@ ; fi && \
chmod $$mode $@ ; }
%.o: %.c
exec $(REALCC) $(CPPFLAGS_ALL) $(CFLAGS_ALL) -c -o $@ $<
%.lo: %.c
exec $(REALCC) $(CPPFLAGS_ALL) $(CFLAGS_ALL) $(CFLAGS_SHARED) -c -o $@ $<
$(ALL_BINS):
exec $(REALCC) -o $@ $(CFLAGS_ALL) $(LDFLAGS_ALL) $(LDFLAGS_NOSHARED) $^ $(EXTRA_LIBS) $(LDLIBS)
.PHONY: it all clean distclean tgz strip install install-bin
.DELETE_ON_ERROR: