abuild/Makefile

135 lines
3.5 KiB
Makefile
Raw Normal View History

2009-05-08 13:33:34 +00:00
PACKAGE := abuild
2021-04-30 11:45:05 +00:00
VERSION := 3.8.0_rc1
2008-10-18 08:09:24 +00:00
2009-06-03 11:24:29 +00:00
prefix ?= /usr
bindir ?= $(prefix)/bin
2009-06-03 11:24:29 +00:00
sysconfdir ?= /etc
sharedir ?= $(prefix)/share/$(PACKAGE)
2017-11-04 05:48:52 +00:00
mandir ?= $(prefix)/share/man
2008-10-18 08:09:24 +00:00
SCRIPTS := abuild abuild-keygen abuild-sign newapkbuild \
abump apkgrel buildlab apkbuild-cpan apkbuild-pypi checkapk \
2014-12-08 15:56:25 +00:00
apkbuild-gem-resolver
USR_BIN_FILES := $(SCRIPTS) abuild-tar abuild-gzsplit abuild-sudo abuild-fetch abuild-rmtemp
2017-11-04 05:48:52 +00:00
MAN_1_PAGES := newapkbuild.1
MAN_5_PAGES := APKBUILD.5
2009-05-08 13:33:34 +00:00
SAMPLES := sample.APKBUILD sample.initd sample.confd \
sample.pre-install sample.post-install
2016-08-12 11:07:30 +00:00
AUTOTOOLS_TOOLCHAIN_FILES := config.sub config.guess
2009-05-08 13:33:34 +00:00
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
2009-05-08 13:33:34 +00:00
SED := sed
TAR := tar
LINK = $(CC) $(OBJS-$@) -o $@ $(LDFLAGS) $(LDFLAGS-$@) $(LIBS-$@)
2009-05-08 13:33:34 +00:00
2020-07-08 10:30:18 +00:00
CFLAGS ?= -Wall -Werror -g
2009-05-08 13:33:34 +00:00
SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
-e 's:@prefix@:$(prefix):g' \
-e 's:@sysconfdir@:$(sysconfdir):g' \
-e 's:@sharedir@:$(sharedir):g' \
2009-05-08 13:33:34 +00:00
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
2009-05-08 13:33:34 +00:00
.SUFFIXES: .sh.in .in
%.sh: %.sh.in
2009-05-08 13:33:34 +00:00
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
${CHMOD} +x $@
2009-05-08 13:33:34 +00:00
%: %.in
2009-05-08 13:33:34 +00:00
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
${CHMOD} +x $@
2009-05-08 13:33:34 +00:00
P=$(PACKAGE)-$(VERSION)
2009-05-08 13:33:34 +00:00
all: $(USR_BIN_FILES) functions.sh
2009-05-08 13:33:34 +00:00
clean:
2019-10-01 14:00:31 +00:00
@rm -f $(USR_BIN_FILES) *.o functions.sh
2009-05-08 13:33:34 +00:00
%.o: %.c
2013-07-05 14:28:28 +00:00
$(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-$@)
2009-05-08 13:33:34 +00:00
2008-10-18 08:09:24 +00:00
help:
@echo "$(P) makefile"
@echo "usage: make install [ DESTDIR=<path> ]"
2019-11-07 11:01:18 +00:00
check: $(USR_BIN_FILE) functions.sh
cd tests && bats $${FILTER:+ --filter $$FILTER} *.bats
2019-11-07 11:01:18 +00:00
install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(sysconfdir) \
$(DESTDIR)/$(sharedir) $(DESTDIR)/$(mandir)/man1 \
2017-11-04 05:48:52 +00:00
$(DESTDIR)/$(mandir)/man5
for i in $(USR_BIN_FILES); do\
install -m 755 $$i $(DESTDIR)/$(bindir)/$$i;\
done
chmod 4555 $(DESTDIR)/$(prefix)/bin/abuild-sudo
for i in adduser addgroup apk; do \
ln -fs abuild-sudo $(DESTDIR)/$(bindir)/abuild-$$i; \
done
2017-11-04 05:48:52 +00:00
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)/
2008-10-18 08:09:24 +00:00
depends depend:
2019-11-07 12:02:24 +00:00
sudo apk --no-cache -U --virtual .abuild-depends add openssl-dev zlib-dev
2010-11-19 10:30:07 +00:00
.gitignore: Makefile
echo "*.tar.bz2" > $@
for i in $(USR_BIN_FILES); do\
echo $$i >>$@;\
done
.PHONY: install