Makefile 1.86 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
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
VERSION		:= 2.0_alpha7

sysconfdir      ?= /etc/lbu

P		:= alpine-conf
PV		:= $(P)-$(VERSION)
TARBZ2		:= $(PV).tar.bz2
PREFIX		?=
TMP		:= $(PV)

LIB_FILES	:= libalpine.sh
SBIN_FILES	:= albootstrap\
		lbu\
		setup-ads\
		setup-alpine\
		setup-alpine-web\
		setup-cryptswap\
		setup-disk\
		setup-dns\
		setup-hostname\
		setup-interfaces\
		setup-keymap\
		setup-mta\
		setup-sendbug\
		setup-webconf\
		update-conf

SCRIPTS		:= $(LIB_FILES) $(SBIN_FILES)
SCRIPT_SOURCES	:= $(addsuffix .in,$(SCRIPTS))

ETC_LBU_FILES	:= lbu.conf
EXTRA_DIST	:= Makefile README
DIST_FILES	:= $(SCRIPT_SOURCES) $(ETC_LBU_FILES) $(EXTRA_DIST)

GIT_REV		:= $(shell 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

Natanael Copa's avatar
Natanael Copa committed
43
44
45
46

DESC="Alpine configuration scripts"
WWW="http://alpinelinux.org/alpine-conf"

Natanael Copa's avatar
Natanael Copa committed
47
48
49
50
51
52
53
54
55
56
57
58
59

SED		:= sed
TAR		:= tar

SED_REPLACE	:= -i -e 's:@VERSION@:$(VERSION):g' \
			-e 's:@PREFIX@:$(PREFIX):g'

.SUFFIXES:	.sh.in .in
.sh.in.sh:
	${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@

.in:
	${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
Natanael Copa's avatar
Natanael Copa committed
60
61

.PHONY:	all apk clean dist install uninstall
Natanael Copa's avatar
Natanael Copa committed
62
all:	$(SCRIPTS)
Natanael Copa's avatar
Natanael Copa committed
63
64
65

apk:	$(APKF)

Natanael Copa's avatar
Natanael Copa committed
66
dist:	$(TARBZ2)
Natanael Copa's avatar
Natanael Copa committed
67
68


Natanael Copa's avatar
Natanael Copa committed
69
$(TARBZ2): $(DIST_FILES)
Natanael Copa's avatar
Natanael Copa committed
70
71
72
	rm -rf $(TMP)
	mkdir -p $(TMP)
	cp $(DIST_FILES) $(TMP)
Natanael Copa's avatar
Natanael Copa committed
73
	$(TAR) -cjf $@ $(TMP)
74
	rm -rf $(TMP)
Natanael Copa's avatar
Natanael Copa committed
75
76
77
78
	
install:
	install -m 755 -d $(DESTDIR)/$(PREFIX)/sbin
	install -m 755 $(SBIN_FILES) $(DESTDIR)/$(PREFIX)/sbin
79
80
	install -m 755 -d $(DESTDIR)/$(PREFIX)/lib
	install -m 755 $(LIB_FILES) $(DESTDIR)/$(PREFIX)/lib
Natanael Copa's avatar
Natanael Copa committed
81
82
	install -m 755 -d $(DESTDIR)/$(sysconfdir)
	install -m 755 $(ETC_LBU_FILES) $(DESTDIR)/$(sysconfdir)
Natanael Copa's avatar
Natanael Copa committed
83
84
85
86
87
88
89
90
91
92

uninstall:
	for i in $(SBIN_FILES); do \
		rm -f "$(DESTDIR)/$(PREFIX)/sbin/$$i";\
	done
	for i in $(LIB_FILES); do \
		rm -f "$(DESTDIR)/$(PREFIX)/lib/$$i";\
	done
	
clean:
Natanael Copa's avatar
Natanael Copa committed
93
	rm -rf $(SCRIPTS) $(TMP) $(TARBZ2)
Natanael Copa's avatar
Natanael Copa committed
94