summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 828c2ecdbdcb0755edb0690f05d109e56fc5fad6 (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
57
58
59
60
61
62
APP_NAME=core
PACKAGE=acf-$(APP_NAME)
VERSION=0.18.9

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

SUBDIRS=app bin lib lua www
EXTRA_DIST=config.mk Makefile README
CONF_FILES=acf.conf
LOGROTATE_FILES=acf

DISTFILES=$(EXTRA_DIST) $(CONF_FILES) $(LOGROTATE_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
	mkdir -p $(DESTDIR)/etc/logrotate.d
	cp $(LOGROTATE_FILES) $(DESTDIR)/etc/logrotate.d
	ln -sf /etc/acf/skins $(DESTDIR)/$(wwwdir)/userskins

include config.mk

.PHONY: $(phony)