summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <natanael.copa@gmail.com>2007-04-05 22:39:14 +0000
committerNatanael Copa <natanael.copa@gmail.com>2007-04-05 22:39:14 +0000
commit769d0255733508aff48c6c41ccee190b48814708 (patch)
treece4d879f4d08a7dc85e4a2a297fd0ff7d65942c6
parente6515dc9861313a48f99545d5b6076677215c04c (diff)
downloadacf-core-769d0255733508aff48c6c41ccee190b48814708.tar.bz2
acf-core-769d0255733508aff48c6c41ccee190b48814708.tar.xz
initial Makefilesv2.0
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@200 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--Makefile12
-rw-r--r--README.makefiles27
-rw-r--r--acf.mk78
-rw-r--r--app/Makefile4
-rw-r--r--app/hello.lua3
-rw-r--r--config.mk10
6 files changed, 134 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..71d678f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,12 @@
+PACKAGE=acf-core
+VERSION=2.0
+
+#SUBDIRS=app cgi-bin lib static www
+SUBDIRS=app
+EXTRA_DIST=README.makefiles
+
+# since this is top level dir we have to set SUBDIR to blank
+SUBDIR=
+
+include config.mk
+include acf.mk
diff --git a/README.makefiles b/README.makefiles
new file mode 100644
index 0000000..34c1bff
--- /dev/null
+++ b/README.makefiles
@@ -0,0 +1,27 @@
+
+The dir locations are defined in config.mk
+
+The following variables may be defined:
+APP_DIST:
+Files are installed in ${appdir}
+
+LIB_DIST:
+Files are installed in ${acflibdir}
+
+ETC_DIST:
+Files are installed in ${sysconfdir}
+
+CGI_DIST:
+Files are installed in ${cgidir}
+
+WWW_DIST:
+
+STATIC_DIST:
+
+EXTRA_DIST:
+Files are not installed, just included in the dist package
+
+Finally the Makefile should contain the following line:
+include ../acf.mk
+
+The acf.mk file contains the rules to perform the install and dist packaging.
diff --git a/acf.mk b/acf.mk
new file mode 100644
index 0000000..3ce18a9
--- /dev/null
+++ b/acf.mk
@@ -0,0 +1,78 @@
+# acf.mk
+
+ACF_MK_VERSION =0.2
+
+SUBDIR =$(basename $(PWD))
+DISTDIR ?=$(PV)
+PV =${PACKAGE}-${VERSION}
+DISTFILES =$(APP_DIST) $(LIB_DIST) $(ETC_DIST) $(CGI_DIST) $(WWW_DIST)\
+ $(STATIC_DIST) $(EXTRA_DIST)
+TARBZ2 =$(PV).tar.bz2
+DISTPKG =$(TARBZ2)
+
+CP =cp
+MKDIR =mkdir
+TAR =tar
+
+MAKEFLAGS += --no-print-directory --quiet
+RECURSIVE_TARGETS = $(addsuffix -recursive,all clean distdir install)
+
+phony += all
+all: all-recursive
+
+phony += $(RECURSIVE_TARGETS)
+$(RECURSIVE_TARGETS):
+ target=`echo $@ | sed 's/-recursive//'` ;\
+ for dir in $(SUBDIRS) ; do \
+ ( cd $$dir && $(MAKE) $$target \
+ DISTDIR="$(PWD)/$(basename $(DISTDIR))" \
+ DESTDIR="$(PWD)/$(basename $(DESTDIR))" \
+ ) || exit 2 ;\
+ done
+
+phony += clean
+clean:
+ if [ -n "$(DISTPKG)" ]; then\
+ $(RM) $(DISTPKG);\
+ fi
+ if [ -n "$(DISTDIR)" ]; then\
+ $(RM) -r $(DISTDIR);\
+ fi
+
+phony += dist
+dist: $(DISTPKG)
+
+$(TARBZ2): distdir
+ echo "Making $@"
+ $(CP) $(DISTFILES) $(DISTDIR)
+ $(TAR) -cjf $@ $(DISTDIR)
+ $(RM) -r $(DISTDIR)
+
+phony += distdir
+distdir: distdir-recursive
+ if [ -z "$(DISTDIR)" ]; then \
+ echo "no DISTDIR in $(SUBDIR)" ;\
+ exit 2 ;\
+ fi
+ for i in $(DISTFILES); do\
+ if [ -n "$(SUBDIR)" ]; then\
+ destdir=$(DISTDIR)/$(SUBDIR)/`dirname $$i`;\
+ else \
+ destdir=$(DISTDIR);\
+ fi;\
+ $(MKDIR) -p "$$destdir" &&\
+ $(CP) "$$i" "$$destdir";\
+ done
+
+phony += pre-install-hook post-install-hook
+
+phony += install
+install: install-recursive
+ if [ -n "$(APP_DIST)" ]; then\
+ echo "Installing app files";\
+ $(MKDIR) -p $(DESTDIR)/$(appdir);\
+ $(CP) $(APP_DIST) $(DESTDIR)/$(appdir);\
+ fi
+ echo "TODO: *_DIST, set permissions, set ownerships"
+
+.PHONY: $(phony)
diff --git a/app/Makefile b/app/Makefile
new file mode 100644
index 0000000..63df57e
--- /dev/null
+++ b/app/Makefile
@@ -0,0 +1,4 @@
+APP_DIST=hello.lua
+
+include ../config.mk
+include ../acf.mk
diff --git a/app/hello.lua b/app/hello.lua
new file mode 100644
index 0000000..a26be1e
--- /dev/null
+++ b/app/hello.lua
@@ -0,0 +1,3 @@
+#!/usr/bin/env lua
+
+print("hello world")
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..45f4d21
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,10 @@
+prefix=/usr
+datadir=${prefix}/share
+sysconfdir=${prefix}/etc
+localstatedir=${prefix}/var
+acfdir=${datadir}/acf
+wwwdir=${acfdir}/www
+cgibindir=${acfdir}/cgi-bin
+appdir=${acfdir}/app
+acflibdir=${acfdir}/lib
+sessionsdir=${localstatedir}/lib/acf/sessions