Makefile 1.12 KB
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
USR_BIN_FILES=abuild devbuild mkalpine buildrepo
5 6
SAMPLES=sample.APKBUILD sample.initd sample.confd sample.pre-install \
	sample.post-install
7
DISTFILES=$(USR_BIN_FILES) $(SAMPLES) Makefile abuild.conf initramfs-init \
8

Natanael Copa's avatar
Natanael Copa committed
9 10 11

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

P=$(PACKAGE)-$(VERSION)

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

21
install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh
Natanael Copa's avatar
Natanael Copa committed
22
	mkdir -p $(DESTDIR)/$(prefix)/bin $(DESTDIR)/$(sysconfdir) \
23
		$(DESTDIR)/$(datadir)
24 25 26
	for i in $(USR_BIN_FILES); do\
		install -m 755 $$i $(DESTDIR)/$(prefix)/bin/$$i;\
	done
27
	if [ -n "$(DESTDIR)" ] || [ ! -f "/$(sysconfdir)"/abuild.conf ]; then\
28 29
		cp abuild.conf $(DESTDIR)/$(sysconfdir)/; \
	fi
30
	cp $(SAMPLES) $(DESTDIR)/$(prefix)/share/abuild
31
	cp functions.sh $(DESTDIR)/$(datadir)/
Natanael Copa's avatar
Natanael Copa committed
32
	cp initramfs-init $(DESTDIR)/$(datadir)/
Natanael Copa's avatar
Natanael Copa committed
33

34
dist:	$(P).tar.bz2
Natanael Copa's avatar
Natanael Copa committed
35

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

.PHONY: install dist