Makefile 1010 Bytes
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1 2

PACKAGE=abuild
3
VERSION:=$(shell  awk -F= '$$1 == "abuild_ver" {print $$2}' abuild)
4 5 6
USR_BIN_FILES=abuild devbuild mkalpine buildrepo
DISTFILES=$(USR_BIN_FILES) Makefile abuild.conf APKBUILD.proto 

Natanael Copa's avatar
Natanael Copa committed
7 8 9

prefix ?= /usr
sysconfdir ?= /etc
10
datadir ?= $(prefix)/share/$(PACKAGE)
Natanael Copa's avatar
Natanael Copa committed
11 12 13 14 15 16 17 18

P=$(PACKAGE)-$(VERSION)

help:
	@echo "$(P) makefile"
	@echo "usage: make install [ DESTDIR=<path> ]"
	@echo "       make dist"

19
install: $(USR_BIN_FILES) abuild.conf APKBUILD.proto functions.sh
Natanael Copa's avatar
Natanael Copa committed
20
	mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
21
		$(DESTDIR)/$(datadir)
22 23 24
	for i in $(USR_BIN_FILES); do\
		install -m 755 $$i $(DESTDIR)/$(prefix)/bin/$$i;\
	done
25 26 27
	if [ -z "$(DESTDIR)" ] && [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
		cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
	fi
Natanael Copa's avatar
Natanael Copa committed
28
	cp APKBUILD.proto $(DESTDIR)/$(prefix)/share/abuild
29
	cp functions.sh $(DESTDIR)/$(datadir)/
Natanael Copa's avatar
Natanael Copa committed
30

31
dist:	$(P).tar.bz2
Natanael Copa's avatar
Natanael Copa committed
32

33
$(P).tar.bz2:	$(DISTFILES)
Natanael Copa's avatar
Natanael Copa committed
34 35 36
	rm -rf $(P)
	mkdir -p $(P)
	cp $(DISTFILES) $(P)/
37
	tar -cjf $@ $(P)
Natanael Copa's avatar
Natanael Copa committed
38 39 40
	rm -rf $(P)

.PHONY: install dist