summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: f4aa057995d6b41e7026d8289aec40a36852594a (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
APP_NAME=core
PACKAGE=acf-$(APP_NAME)
VERSION=0.3.3

P=$(PACKAGE)-$(VERSION)
DISTDIR:=$(shell pwd)/$(P)
DISTPKG=$(P).tar.bz2

SUBDIRS=app lib www
EXTRA_DIST=ChangeLog config.mk Makefile README TODO
CONF_FILES=acf.conf passwd roles

DISTFILES=$(EXTRA_DIST) $(CONF_FILES)

CP=cp
TAR=tar

RECURSIVE_TARGETS=all-recursive install-recursive distdir-recursive \
	clean-recursive
phony+=$(RECURSIVE_TARGETS)

export DISTDIR DESTDIR
$(RECURSIVE_TARGETS):
	target=`echo $@ | sed 's/-recursive//'`;\
	for dir in $(SUBDIRS); do\
		( cd $$dir && $(MAKE) $$target ) || exit 1;\
	done

phony += all
all:	all-recursive

phony += clean
clean:	clean-recursive
	rm -rf $(DISTDIR) $(DISTPKG)

phony += distdir
distdir: distdir-recursive $(DISTFILES)
	for i in $(DISTFILES) ; do\
		dest="$(DISTDIR)/$$i";\
		mkdir -p `dirname $$dest` &&\
		$(CP) "$$i" "$$dest" || exit 1;\
	done

phony += dist
dist: 	$(DISTPKG)

$(DISTPKG): distdir $(DISTFILES)
	$(TAR) -chjf $@ $(P)
	rm -r $(DISTDIR)

phony+=install
install: install-recursive $(CONF_FILES)
	mkdir -p $(DESTDIR)/etc/acf
	cp $(CONF_FILES) $(DESTDIR)/etc/acf

.PHONY: $(phony)