From 769d0255733508aff48c6c41ccee190b48814708 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 5 Apr 2007 22:39:14 +0000 Subject: initial Makefiles git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@200 ab2d0c66-481e-0410-8bed-d214d4d58bed --- Makefile | 12 +++++++++ README.makefiles | 27 ++++++++++++++++++++ acf.mk | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app/Makefile | 4 +++ app/hello.lua | 3 +++ config.mk | 10 ++++++++ 6 files changed, 134 insertions(+) create mode 100644 Makefile create mode 100644 README.makefiles create mode 100644 acf.mk create mode 100644 app/Makefile create mode 100644 app/hello.lua create mode 100644 config.mk 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 -- cgit v1.2.3