blob: 8c54ca22f43106b9dbb4684adc938cfd3f441036 (
plain) (
blame)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
PACKAGE := abuild
VERSION := 3.4.0
prefix ?= /usr
bindir ?= $(prefix)/bin
sysconfdir ?= /etc
sharedir ?= $(prefix)/share/$(PACKAGE)
mandir ?= $(prefix)/share/man
SCRIPTS := abuild abuild-keygen abuild-sign newapkbuild \
abump apkgrel buildlab apkbuild-cpan apkbuild-pypi checkapk \
apkbuild-gem-resolver
USR_BIN_FILES := $(SCRIPTS) abuild-tar abuild-gzsplit abuild-sudo abuild-fetch abuild-rmtemp
MAN_1_PAGES := newapkbuild.1
MAN_5_PAGES := APKBUILD.5
SAMPLES := sample.APKBUILD sample.initd sample.confd \
sample.pre-install sample.post-install
AUTOTOOLS_TOOLCHAIN_FILES := config.sub config.guess
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
GIT_REV := $(shell test -d .git && git describe || echo exported)
ifneq ($(GIT_REV), exported)
FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
FULL_VERSION := $(patsubst v%,%,$(FULL_VERSION))
else
FULL_VERSION := $(VERSION)
endif
CHMOD := chmod
SED := sed
TAR := tar
LINK = $(CC) $(OBJS-$@) -o $@ $(LDFLAGS) $(LDFLAGS-$@) $(LIBS-$@)
SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
-e 's:@prefix@:$(prefix):g' \
-e 's:@sysconfdir@:$(sysconfdir):g' \
-e 's:@sharedir@:$(sharedir):g' \
SSL_CFLAGS ?= $(shell pkg-config --cflags openssl)
SSL_LDFLAGS ?= $(shell pkg-config --cflags openssl)
SSL_LIBS ?= $(shell pkg-config --libs openssl)
ZLIB_LIBS ?= $(shell pkg-config --libs zlib)
OBJS-abuild-tar = abuild-tar.o
CFLAGS-abuild-tar.o = $(SSL_CFLAGS)
LDFLAGS-abuild-tar = $(SSL_LDFLAGS)
LIBS-abuild-tar = $(SSL_LIBS)
LIBS-abuild-tar.static = $(LIBS-abuild-tar)
OBJS-abuild-gzsplit = abuild-gzsplit.o
LDFLAGS-abuild-gzsplit = $(ZLIB_LIBS)
OBJS-abuild-sudo = abuild-sudo.o
OBJS-abuild-fetch = abuild-fetch.o
.SUFFIXES: .sh.in .in
%.sh: %.sh.in
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
${CHMOD} +x $@
%: %.in
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
${CHMOD} +x $@
P=$(PACKAGE)-$(VERSION)
all: $(USR_BIN_FILES) functions.sh
clean:
@rm -f $(USR_BIN_FILES) *.o functions.sh
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) -o $@ -c $<
abuild-sudo: abuild-sudo.o
$(LINK)
abuild-tar: abuild-tar.o
$(LINK)
abuild-fetch: abuild-fetch.o
$(LINK)
abuild-gzsplit: abuild-gzsplit.o
$(LINK)
abuild-tar.static: abuild-tar.o
$(CC) -static $(CPPFLAGS) $(CFLAGS) $(CFLAGS-$@) $^ -o $@ $(LIBS-$@)
help:
@echo "$(P) makefile"
@echo "usage: make install [ DESTDIR=<path> ]"
check: $(USR_BIN_FILE) functions.sh
cd tests && bats *.bats
install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(sysconfdir) \
$(DESTDIR)/$(sharedir) $(DESTDIR)/$(mandir)/man1 \
$(DESTDIR)/$(mandir)/man5
for i in $(USR_BIN_FILES); do\
install -m 755 $$i $(DESTDIR)/$(bindir)/$$i;\
done
chmod 4111 $(DESTDIR)/$(prefix)/bin/abuild-sudo
for i in adduser addgroup apk; do \
ln -fs abuild-sudo $(DESTDIR)/$(bindir)/abuild-$$i; \
done
for i in $(MAN_1_PAGES); do\
install -m 644 $$i $(DESTDIR)/$(mandir)/man1/$$i;\
done
for i in $(MAN_5_PAGES); do\
install -m 644 $$i $(DESTDIR)/$(mandir)/man5/$$i;\
done
if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
fi
cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild/
cp $(AUTOTOOLS_TOOLCHAIN_FILES) $(DESTDIR)/$(prefix)/share/abuild/
cp functions.sh $(DESTDIR)/$(sharedir)/
.gitignore: Makefile
echo "*.tar.bz2" > $@
for i in $(USR_BIN_FILES); do\
echo $$i >>$@;\
done
.PHONY: install
|