2008-10-18 08:09:24 +00:00
|
|
|
|
2009-05-08 13:33:34 +00:00
|
|
|
PACKAGE := abuild
|
2011-04-17 12:56:35 +00:00
|
|
|
VERSION := 2.9.2
|
2008-10-18 08:09:24 +00:00
|
|
|
|
2009-06-03 11:24:29 +00:00
|
|
|
prefix ?= /usr
|
|
|
|
sysconfdir ?= /etc
|
|
|
|
datadir ?= $(prefix)/share/$(PACKAGE)
|
2011-04-04 13:06:32 +00:00
|
|
|
abuildrepo ?= ~/.cache/abuild
|
2008-10-18 08:09:24 +00:00
|
|
|
|
2010-12-13 14:14:06 +00:00
|
|
|
LUA_VERSION = 5.1
|
|
|
|
LUA_SHAREDIR ?= $(prefix)/share/lua/$(LUA_VERSION)/
|
|
|
|
|
2010-07-20 11:31:43 +00:00
|
|
|
SCRIPTS := abuild devbuild buildrepo abuild-keygen \
|
2011-05-31 14:34:46 +00:00
|
|
|
abuild-sign newapkbuild abump apkgrel ap buildlab \
|
2011-06-02 08:55:00 +00:00
|
|
|
apkbuild-cpan
|
2009-07-20 14:54:20 +00:00
|
|
|
USR_BIN_FILES := $(SCRIPTS) abuild-tar
|
2009-05-08 13:33:34 +00:00
|
|
|
SAMPLES := sample.APKBUILD sample.initd sample.confd \
|
|
|
|
sample.pre-install sample.post-install
|
|
|
|
|
|
|
|
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
|
|
|
|
|
|
|
|
DISTFILES=$(SCRIPT_SOURCES) $(SAMPLES) Makefile abuild.conf
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2009-10-24 20:37:20 +00:00
|
|
|
CHMOD := chmod
|
2009-05-08 13:33:34 +00:00
|
|
|
SED := sed
|
|
|
|
TAR := tar
|
|
|
|
|
|
|
|
SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
|
|
|
|
-e 's:@prefix@:$(prefix):g' \
|
|
|
|
-e 's:@sysconfdir@:$(sysconfdir):g' \
|
2009-06-03 11:24:29 +00:00
|
|
|
-e 's:@datadir@:$(datadir):g' \
|
2010-05-06 07:58:44 +00:00
|
|
|
-e 's:@abuildrepo@:$(abuildrepo):g'
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2010-05-18 12:44:05 +00:00
|
|
|
SSL_CFLAGS := $(shell pkg-config --cflags openssl)
|
2009-07-20 14:54:20 +00:00
|
|
|
SSL_LIBS := $(shell pkg-config --libs openssl)
|
|
|
|
|
2009-05-08 13:33:34 +00:00
|
|
|
.SUFFIXES: .sh.in .in
|
|
|
|
.sh.in.sh:
|
|
|
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
2009-10-24 20:37:20 +00:00
|
|
|
${CHMOD} +x $@
|
2009-05-08 13:33:34 +00:00
|
|
|
|
|
|
|
.in:
|
|
|
|
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
2009-10-24 20:37:20 +00:00
|
|
|
${CHMOD} +x $@
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2009-07-20 14:54:20 +00:00
|
|
|
P=$(PACKAGE)-$(VERSION)
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2009-07-20 14:54:20 +00:00
|
|
|
all: $(USR_BIN_FILES)
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2009-07-20 14:54:20 +00:00
|
|
|
clean:
|
|
|
|
@rm -f $(USR_BIN_FILES)
|
2009-05-08 13:33:34 +00:00
|
|
|
|
2009-07-20 14:54:20 +00:00
|
|
|
abuild-tar: abuild-tar.c
|
2010-05-18 12:44:05 +00:00
|
|
|
$(CC) -o $@ $^ -Wl,--as-needed $(SSL_LIBS)
|
|
|
|
|
|
|
|
abuild-tar.static: abuild-tar.c
|
|
|
|
$(CC) -o $@ -static $(SSL_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> ]"
|
|
|
|
@echo " make dist"
|
|
|
|
|
2010-12-13 14:14:06 +00:00
|
|
|
install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh aports.lua
|
2008-10-30 15:55:25 +00:00
|
|
|
mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
|
2009-01-03 10:05:12 +00:00
|
|
|
$(DESTDIR)/$(datadir)
|
2009-01-15 15:48:16 +00:00
|
|
|
for i in $(USR_BIN_FILES); do\
|
|
|
|
install -m 755 $$i $(DESTDIR)/$(prefix)/bin/$$i;\
|
|
|
|
done
|
2009-01-19 09:19:20 +00:00
|
|
|
if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
|
2009-01-07 18:29:19 +00:00
|
|
|
cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
|
|
|
|
fi
|
2009-01-29 09:06:43 +00:00
|
|
|
cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild
|
2009-01-03 10:05:12 +00:00
|
|
|
cp functions.sh $(DESTDIR)/$(datadir)/
|
2010-12-13 14:14:06 +00:00
|
|
|
mkdir -p $(DESTDIR)$(LUA_SHAREDIR)
|
|
|
|
cp aports.lua $(DESTDIR)$(LUA_SHAREDIR)/
|
2008-10-18 08:09:24 +00:00
|
|
|
|
2009-01-15 15:48:16 +00:00
|
|
|
dist: $(P).tar.bz2
|
2008-10-18 08:09:24 +00:00
|
|
|
|
2009-01-15 15:48:16 +00:00
|
|
|
$(P).tar.bz2: $(DISTFILES)
|
2008-10-18 08:09:24 +00:00
|
|
|
rm -rf $(P)
|
|
|
|
mkdir -p $(P)
|
|
|
|
cp $(DISTFILES) $(P)/
|
2009-01-15 15:48:16 +00:00
|
|
|
tar -cjf $@ $(P)
|
2008-10-18 08:09:24 +00:00
|
|
|
rm -rf $(P)
|
|
|
|
|
2010-11-19 10:30:07 +00:00
|
|
|
.gitignore: Makefile
|
|
|
|
echo "*.tar.bz2" > $@
|
|
|
|
for i in $(USR_BIN_FILES); do\
|
|
|
|
echo $$i >>$@;\
|
|
|
|
done
|
|
|
|
|
|
|
|
|
2008-10-18 08:09:24 +00:00
|
|
|
.PHONY: install dist
|