aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-10 16:35:59 +0000
committerRoy Marples <roy@marples.name>2008-01-10 16:35:59 +0000
commit43147845209873b0776bd75d363913fe25611f49 (patch)
treeab3295c30664476d8d05b0fe5fe9ace702ade5ea
parent2643f2e605f102d2c2fa098d0cf5400d3795ed4a (diff)
Allow for OS and SUBOS folders so we can introduce NetBSD scripts whilst keeping BSD for all BSD's.
-rw-r--r--Makefile40
-rw-r--r--README3
-rw-r--r--conf.d.BSD/Makefile8
-rw-r--r--conf.d.Linux/Makefile10
-rw-r--r--conf.d/Makefile8
-rw-r--r--default.mk65
-rw-r--r--doc.BSD/Makefile8
-rw-r--r--doc.Linux/Makefile8
-rw-r--r--etc.BSD/Makefile10
-rw-r--r--etc.Linux/Makefile8
-rw-r--r--etc/Makefile8
-rw-r--r--init.d.BSD/Makefile8
-rw-r--r--init.d.Linux/Makefile8
-rw-r--r--init.d/Makefile8
-rw-r--r--man/Makefile61
-rw-r--r--mk/.mk (renamed from src/.mk)0
-rw-r--r--mk/cc.mk (renamed from src/cc.mk)0
-rw-r--r--mk/depend.mk (renamed from src/depend.mk)0
-rw-r--r--mk/lib.mk (renamed from src/lib.mk)2
-rw-r--r--mk/ncurses.mk (renamed from src/ncurses.mk)0
-rw-r--r--mk/os.mk (renamed from src/os.mk)15
-rw-r--r--mk/pam.mk (renamed from src/pam.mk)0
-rw-r--r--mk/prog.mk (renamed from src/prog.mk)2
-rw-r--r--mk/scripts.mk34
-rw-r--r--mk/subdir.mk39
-rw-r--r--mk/termcap.mk (renamed from src/termcap.mk)0
-rw-r--r--net.BSD/Makefile8
-rw-r--r--net.Linux/Makefile8
-rw-r--r--net/Makefile8
-rw-r--r--runlevels.BSD/Makefile10
-rw-r--r--runlevels.Linux/Makefile10
-rw-r--r--runlevels.mk23
-rw-r--r--runlevels/Makefile17
-rw-r--r--sh.BSD/Makefile8
-rw-r--r--sh.Linux/Makefile8
-rw-r--r--sh/Makefile33
-rw-r--r--src/Makefile4
-rw-r--r--src/includes/hidden-visibility.h (renamed from src/hidden-visibility.h)0
-rw-r--r--src/includes/rc-misc.h (renamed from src/rc-misc.h)0
-rw-r--r--src/includes/strlist.h (renamed from src/strlist.h)0
-rw-r--r--src/libeinfo/Makefile16
-rw-r--r--src/librc/Makefile10
-rw-r--r--src/rc/Makefile21
-rw-r--r--subdir.mk27
44 files changed, 257 insertions, 307 deletions
diff --git a/Makefile b/Makefile
index 55d8c6aa..f02c97ea 100644
--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,19 @@
# OpenRC Makefile
-# Copyright 2007 Roy Marples
+# Copyright 2007-2008 Roy Marples
# Distributed under the terms of the GNU General Public License v2
-NAME = openrc
-VERSION = 0.1
-PKG = $(NAME)-$(VERSION)
+NAME= openrc
+VERSION= 0.1
+PKG= ${NAME}-${VERSION}
-SUBDIR = conf.d doc etc init.d man net runlevels sh src
+SUBDIR= conf.d doc etc init.d man net runlevels sh src
-TOPDIR = .
-include $(TOPDIR)/default.mk
+MK= mk
+include ${MK}/os.mk
+include ${MK}/subdir.mk
+include ${MK}/dist.mk
-install::
- $(INSTALL) -d $(DESTDIR)$(RC_LIB)/init.d
- $(INSTALL) -d $(DESTDIR)$(RC_LIB)/tmp
-
-clean::
- rm -f *.bz2
-
-dist:
- $(INSTALL) -d /tmp/$(PKG)
- cp -RPp . /tmp/$(PKG)
- (cd /tmp/$(PKG); git clean; $(MAKE) clean)
- rm -rf /tmp/$(PKG)/*.bz2 /tmp/$(PKG)/.git /tmp/$(PKG)/test
- rm -rf /tmp/$(PKG)/.gitignore /tmp/$(PKG)/src/.gitignore
- sed -i.bak -e '/LDFLAGS += -Wl,-rpath ./ s/^/#/' /tmp/$(PKG)/src/Makefile
- rm -f /tmp/$(PKG)/src/Makefile.bak
- tar cvjpf $(PKG).tar.bz2 -C /tmp $(PKG)
- rm -rf /tmp/$(PKG)
- ls -l $(PKG).tar.bz2
-
-# vim: set ts=4 :
+INSTALLAFTER= _installafter
+_installafter:
+ ${INSTALL} -d ${DESTDIR}${RC_LIB}/init.d
+ ${INSTALL} -d ${DESTDIR}${RC_LIB}/tmp
diff --git a/README b/README
index 056971bb..935ae5fd 100644
--- a/README
+++ b/README
@@ -4,8 +4,7 @@ OpenRC README
Installation
------------
make install
-Yup, that simple. Works with GNU make, FreeBSD make and pmake. Should work
-with every other make too.
+Yup, that simple. Works with GNU make and BSD make.
You may wish to tweak the installation with the below arguments
PROGLDFLAGS=-static
diff --git a/conf.d.BSD/Makefile b/conf.d.BSD/Makefile
index dd2e315b..c48abbfa 100644
--- a/conf.d.BSD/Makefile
+++ b/conf.d.BSD/Makefile
@@ -1,5 +1,5 @@
-DIR = /etc/conf.d
-CONF = $(CONTENTS)
+DIR= /etc/conf.d
+CONF= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/conf.d.Linux/Makefile b/conf.d.Linux/Makefile
index 169a7e4f..b8a5bf79 100644
--- a/conf.d.Linux/Makefile
+++ b/conf.d.Linux/Makefile
@@ -1,6 +1,6 @@
-DIR = /etc/conf.d
-CONF = consolefont keymaps modules
-CONF_APPEND = clock
+DIR= /etc/conf.d
+CONF= consolefont keymaps modules
+CONF_APPEND= clock
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/conf.d/Makefile b/conf.d/Makefile
index f26da996..c48e551a 100644
--- a/conf.d/Makefile
+++ b/conf.d/Makefile
@@ -1,5 +1,5 @@
-DIR = /etc/conf.d
-CONF = $(CONTENTS)
+DIR= /etc/conf.d
+CONF= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/default.mk b/default.mk
deleted file mode 100644
index 65f2443e..00000000
--- a/default.mk
+++ /dev/null
@@ -1,65 +0,0 @@
-# Common makefile settings
-# We shouldn't use PREFIX as we need to install into /
-
-_LIBNAME_SH= l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
-_LIBNAME!= ${_LIBNAME_SH}
-LIBNAME= ${_LIBNAME}$(shell ${_LIBNAME_SH})
-RC_LIB= /${LIBNAME}/rc
-
-INSTALL?= install
-
-_OS_SH= u=`uname -s`; case "$${u}" in *BSD|DragonFly) echo "BSD";; *) echo "$${u}";; esac
-_OS!= ${_OS_SH}
-OS?= ${_OS}$(shell ${_OS_SH})
-
-# We store the contents of the directory for ease of use in Makefiles
-_CONTENTS_SH= ls -1 | grep -v Makefile | xargs
-_CONTENTS!= ${_CONTENTS_SH}
-CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH})
-
-# Recursive rules
-# Adapted from FreeBSDs bsd.subdir.mk
-_+_ ?= +
-ECHODIR ?= echo
-_SUBDIR = @${_+_}for x in ${SUBDIR}; do \
- if test -d $$x; then \
- ${ECHODIR} "===> ${DIRPRFX}$$x ($@)"; \
- cd $$x; \
- ${MAKE} $@ DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
- cd ..; \
- fi; \
- if test -d $$x.${OS}; then \
- ${ECHODIR} "===> ${DIRPRFX}$$x.${OS} ($@)"; \
- cd $$x.${OS}; \
- ${MAKE} $@ DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
- cd ..; \
- fi; \
-done
-
-all:
- ${_SUBDIR}
-clean::
- ${_SUBDIR}
-depend::
- ${_SUBDIR}
-install::
- ${_SUBDIR}
-
-install:: ${BIN} ${CONF} ${CONF_APPEND}
- if test -n "${DIR}"; then ${INSTALL} -d ${DESTDIR}${DIR} || exit $$?; fi
- if test -n "${BIN}"; then ${INSTALL} ${BIN} ${DESTDIR}${DIR} || exit $$?; fi
- if test -n "${INC}"; then ${INSTALL} -m 0644 ${INC} ${DESTDIR}${DIR} || exit $$?; fi
- for x in ${CONF}; do \
- if ! test -e ${DESTDIR}${DIR}/$$x; then \
- ${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
- fi; \
- done
- for x in ${CONF_APPEND}; do \
- if test -e ${DESTDIR}${DIR}/$$x; then \
- cat $$x >> ${DESTDIR}${DIR}/$$x || exit $$?; \
- else \
- ${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
- fi; \
- done
-
-# vim: set ts=4 :
diff --git a/doc.BSD/Makefile b/doc.BSD/Makefile
index 41ba09f9..029dfa7a 100644
--- a/doc.BSD/Makefile
+++ b/doc.BSD/Makefile
@@ -1,5 +1,5 @@
-DIR = /usr/share/doc/openrc
-INC = $(CONTENTS)
+DIR= /usr/share/doc/openrc
+INC= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/doc.Linux/Makefile b/doc.Linux/Makefile
index 41ba09f9..029dfa7a 100644
--- a/doc.Linux/Makefile
+++ b/doc.Linux/Makefile
@@ -1,5 +1,5 @@
-DIR = /usr/share/doc/openrc
-INC = $(CONTENTS)
+DIR= /usr/share/doc/openrc
+INC= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/etc.BSD/Makefile b/etc.BSD/Makefile
index 1e5b056e..639b927c 100644
--- a/etc.BSD/Makefile
+++ b/etc.BSD/Makefile
@@ -1,6 +1,6 @@
-DIR = /etc
-CONF = devd.conf rc rc.shutdown
-BIN = rc.devd
+DIR= /etc
+CONF= devd.conf rc rc.shutdown
+BIN= rc.devd
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/etc.Linux/Makefile b/etc.Linux/Makefile
index ad04fec9..77a782ab 100644
--- a/etc.Linux/Makefile
+++ b/etc.Linux/Makefile
@@ -1,5 +1,5 @@
-DIR = /etc
-CONF_APPEND = rc.conf
+DIR= /etc
+CONF_APPEND= rc.conf
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/etc/Makefile b/etc/Makefile
index 0b889a9c..869430f8 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -1,5 +1,5 @@
-DIR = /etc
-CONF = rc.conf
+DIR= /etc
+CONF= rc.conf
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/init.d.BSD/Makefile b/init.d.BSD/Makefile
index c50e550a..da0be63d 100644
--- a/init.d.BSD/Makefile
+++ b/init.d.BSD/Makefile
@@ -1,5 +1,5 @@
-DIR = /etc/init.d
-BIN = $(CONTENTS)
+DIR= /etc/init.d
+BIN= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/init.d.Linux/Makefile b/init.d.Linux/Makefile
index c50e550a..da0be63d 100644
--- a/init.d.Linux/Makefile
+++ b/init.d.Linux/Makefile
@@ -1,5 +1,5 @@
-DIR = /etc/init.d
-BIN = $(CONTENTS)
+DIR= /etc/init.d
+BIN= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/init.d/Makefile b/init.d/Makefile
index 3b4e1a27..88a2f284 100644
--- a/init.d/Makefile
+++ b/init.d/Makefile
@@ -1,5 +1,5 @@
-DIR = /etc/init.d
-BIN = $(CONTENTS)
+DIR= /etc/init.d
+BIN= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/man/Makefile b/man/Makefile
index 5375ce90..eaae253f 100644
--- a/man/Makefile
+++ b/man/Makefile
@@ -1,34 +1,37 @@
-DIR = /usr/share/man
-_MAN3_SH = ls -1 *.3
-_MAN3 != $(_MAN3_SH)
-MAN3 = $(_MAN3)$(shell $(_MAN3_SH))
-_MAN8_SH = ls -1 *.8
-_MAN8 != $(_MAN8_SH)
-MAN8 = $(_MAN8)$(shell $(_MAN8_SH))
-
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+DIR= /usr/share/man
+_MAN3_SH= ls -1 *.3
+_MAN3!= ${_MAN3_SH}
+MAN3= ${_MAN3}$(shell ${_MAN3_SH})
+_MAN8_SH= ls -1 *.8
+_MAN8!= ${_MAN8_SH}
+MAN8= ${_MAN8}$(shell ${_MAN8_SH})
# Handy macro to create symlinks
# This does rely on correctly formatting our manpages!
-MAKE_LINKS = suffix=$${man\#*.}; \
- prefix=$${man%%.*}; \
- for link in `sed -e 's/ ,//g' \
- -n -e '/^\.Sh NAME$$/,/\.Sh/ s/\.Nm //p' $${man}`; do \
- if test "$${link}" != "$${prefix}" ; then \
- ln -sf $${man} \
- $(DESTDIR)/$(DIR)/man$${suffix}/$${link}.$${suffix} ; \
- fi; \
- done;
+MAKE_LINKS= suffix=$${man\#*.}; \
+ prefix=$${man%%.*}; \
+ for link in `sed -e 's/ ,//g' \
+ -n -e '/^\.Sh NAME$$/,/\.Sh/ s/\.Nm //p' $${man}`; do \
+ if test "$${link}" != "$${prefix}" ; then \
+ ln -sf $${man} \
+ ${DESTDIR}/${DIR}/man$${suffix}/$${link}.$${suffix} ; \
+ fi; \
+ done;
-install::
- $(INSTALL) -d $(DESTDIR)/$(DIR)/man3
- for man in $(MAN3); do \
- $(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man3 || exit $$?; \
- $(MAKE_LINKS) \
- done
- $(INSTALL) -d $(DESTDIR)/$(DIR)/man8
- for man in $(MAN8); do \
- $(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man8 || exit $$?; \
- $(MAKE_LINKS) \
+INSTALL?= install
+
+all:
+
+install:
+ ${INSTALL} -d ${DESTDIR}/${DIR}/man3
+ for man in ${MAN3}; do \
+ ${INSTALL} -m 0644 "$$man" ${DESTDIR}/${DIR}/man3 || exit $$?; \
+ ${MAKE_LINKS} \
done
+ ${INSTALL} -d ${DESTDIR}/${DIR}/man8
+ for man in ${MAN8}; do \
+ ${INSTALL} -m 0644 "$$man" ${DESTDIR}/${DIR}/man8 || exit $$?; \
+ ${MAKE_LINKS} \
+ done
+
+clean:
diff --git a/src/.mk b/mk/.mk
index e69de29b..e69de29b 100644
--- a/src/.mk
+++ b/mk/.mk
diff --git a/src/cc.mk b/mk/cc.mk
index 18eae7ee..18eae7ee 100644
--- a/src/cc.mk
+++ b/mk/cc.mk
diff --git a/src/depend.mk b/mk/depend.mk
index a4d717ae..a4d717ae 100644
--- a/src/depend.mk
+++ b/mk/depend.mk
diff --git a/src/lib.mk b/mk/lib.mk
index e7759173..7a570ebe 100644
--- a/src/lib.mk
+++ b/mk/lib.mk
@@ -62,4 +62,4 @@ install: all
clean:
rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES}
-include ${TOPDIR}/depend.mk
+include ${MK}/depend.mk
diff --git a/src/ncurses.mk b/mk/ncurses.mk
index 66573d61..66573d61 100644
--- a/src/ncurses.mk
+++ b/mk/ncurses.mk
diff --git a/src/os.mk b/mk/os.mk
index a4bef109..aca062c7 100644
--- a/src/os.mk
+++ b/mk/os.mk
@@ -2,14 +2,21 @@
# Generic definitions
-_OS_SH= u=`uname -s`; case "$${u}" in *BSD|DragonFly) echo "BSD";; *) echo "$${u}";; esac
-_OS!= ${_OS_SH}
-OS?= ${_OS}$(shell ${_OS_SH})
+_OS_SH_= uname -s
+_OS!= ${_OS_SH}
+OS?= ${_OS}$(shell ${_OS_SH})
+
+_SUBOS_SH= case `uname -s` in \
+ *BSD|DragonFly) echo "BSD";; \
+ *) echo "";; \
+ esac
+_SUBOS!= ${_SUBOS_SH}
+SUBOS?= ${_SUBOS}$(shell ${_SUBOS_SH})
_LIBNAME_SH= l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
_LIBNAME!= ${_LIBNAME_SH}
LIBNAME?= ${_LIBNAME}$(shell ${_LIBNAME_SH})
-RC_LIB= /$(LIB)/rc
+RC_LIB= /$(LIBNAME)/rc
_DEF_SH= case `uname -s` in Linux) echo "-D_XOPEN_SOURCE=600 -D_BSD_SOURCE";; *) echo;; esac
_DEF!= ${_DEF_SH}
diff --git a/src/pam.mk b/mk/pam.mk
index 7d0f2ca0..7d0f2ca0 100644
--- a/src/pam.mk
+++ b/mk/pam.mk
diff --git a/src/prog.mk b/mk/prog.mk
index 5da7e75f..716707c6 100644
--- a/src/prog.mk
+++ b/mk/prog.mk
@@ -16,4 +16,4 @@ ${PROG}: ${SCRIPTS} ${OBJS}
clean:
rm -f ${OBJS} ${PROG} ${CLEANFILES}
-include ${TOPDIR}/depend.mk
+include ${MK}/depend.mk
diff --git a/mk/scripts.mk b/mk/scripts.mk
new file mode 100644
index 00000000..806a5453
--- /dev/null
+++ b/mk/scripts.mk
@@ -0,0 +1,34 @@
+# Install rules for our scripts
+# Copyright 2007-2008 Roy Marples <roy@marples.name>
+
+# We store the contents of the directory for ease of use in Makefiles
+_CONTENTS_SH= ls -1 | grep -v Makefile | xargs
+_CONTENTS!= ${_CONTENTS_SH}
+CONTENTS= ${_CONTENTS}$(shell ${_CONTENTS_SH})
+
+INSTALL?= install
+
+include ${MK}/os.mk
+
+all:
+
+realinstall: ${BIN} ${CONF} ${CONF_APPEND}
+ if test -n "${DIR}"; then ${INSTALL} -d ${DESTDIR}${DIR} || exit $$?; fi
+ if test -n "${BIN}"; then ${INSTALL} ${BIN} ${DESTDIR}${DIR} || exit $$?; fi
+ if test -n "${INC}"; then ${INSTALL} -m 0644 ${INC} ${DESTDIR}${DIR} || exit $$?; fi
+ for x in ${CONF}; do \
+ if ! test -e ${DESTDIR}${DIR}/$$x; then \
+ ${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
+ fi; \
+ done
+ for x in ${CONF_APPEND}; do \
+ if test -e ${DESTDIR}${DIR}/$$x; then \
+ cat $$x >> ${DESTDIR}${DIR}/$$x || exit $$?; \
+ else \
+ ${INSTALL} -m 0644 $$x ${DESTDIR}${DIR} || exit $$?; \
+ fi; \
+ done
+
+install: realinstall ${INSTALLAFTER}
+
+clean:
diff --git a/mk/subdir.mk b/mk/subdir.mk
new file mode 100644
index 00000000..97502353
--- /dev/null
+++ b/mk/subdir.mk
@@ -0,0 +1,39 @@
+# Recursive rules
+# Adapted from FreeBSDs bsd.subdir.mk
+# Copyright 2007-2008 Roy Marples <roy@marples.name>
+
+_+_ ?= +
+ECHODIR ?= echo
+_SUBDIR = @${_+_}for x in ${SUBDIR}; do \
+ if test -d $$x; then \
+ ${ECHODIR} "===> ${DIRPRFX}$$x (${@:realinstall=install})"; \
+ cd $$x; \
+ ${MAKE} ${@:realinstall=install} \
+ DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
+ cd ..; \
+ fi; \
+ if test -d $$x.${OS}; then \
+ ${ECHODIR} "===> ${DIRPRFX}$$x.${OS} (${@:realinstall=install})"; \
+ cd $$x.${OS}; \
+ ${MAKE} ${@:realinstall=install} \
+ DIRPRFX=${DIRPRFX}$$x.${OS}/ || exit $$?; \
+ cd ..; \
+ fi; \
+ if test -d $$x.${SUBOS}; then \
+ ${ECHODIR} "===> ${DIRPRFX}$$x.${SUBOS} (${@:realinstall=install})"; \
+ cd $$x.${SUBOS}; \
+ ${MAKE} ${@:realinstall=install} \
+ DIRPRFX=${DIRPRFX}$$x.${SUBOS}/ || exit $$?; \
+ cd ..; \
+ fi; \
+done
+
+all:
+ ${_SUBDIR}
+clean:
+ ${_SUBDIR}
+realinstall:
+ ${_SUBDIR}
+install: realinstall ${INSTALLAFTER}
+depend:
+ ${_SUBDIR}
diff --git a/src/termcap.mk b/mk/termcap.mk
index 62a251ac..62a251ac 100644
--- a/src/termcap.mk
+++ b/mk/termcap.mk
diff --git a/net.BSD/Makefile b/net.BSD/Makefile
index 62462763..b2becc4e 100644
--- a/net.BSD/Makefile
+++ b/net.BSD/Makefile
@@ -1,5 +1,5 @@
-DIR = $(RC_LIB)/net
-INC = $(CONTENTS)
+DIR = ${RC_LIB}/net
+INC = ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/net.Linux/Makefile b/net.Linux/Makefile
index 62462763..b2becc4e 100644
--- a/net.Linux/Makefile
+++ b/net.Linux/Makefile
@@ -1,5 +1,5 @@
-DIR = $(RC_LIB)/net
-INC = $(CONTENTS)
+DIR = ${RC_LIB}/net
+INC = ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/net/Makefile b/net/Makefile
index 62462763..5ea18a1e 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1,5 +1,5 @@
-DIR = $(RC_LIB)/net
-INC = $(CONTENTS)
+DIR= ${RC_LIB}/net
+INC= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/runlevels.BSD/Makefile b/runlevels.BSD/Makefile
index 5a0e6b52..0abbb19e 100644
--- a/runlevels.BSD/Makefile
+++ b/runlevels.BSD/Makefile
@@ -1,7 +1,5 @@
-BOOT = dumpon hostid net.lo0 newsyslog savecore syscons syslogd
-DEFAULT = local.rc mixer powerd
+BOOT= dumpon hostid net.lo0 newsyslog savecore syscons syslogd
+DEFAULT= local.rc mixer powerd
-TOPDIR = ..
-include $(TOPDIR)/runlevels.mk
-
-# vim: set ts=4 :
+MK= ../mk
+include ${MK}/runlevels.mk
diff --git a/runlevels.Linux/Makefile b/runlevels.Linux/Makefile
index 73a0acbe..8271bb56 100644
--- a/runlevels.Linux/Makefile
+++ b/runlevels.Linux/Makefile
@@ -1,7 +1,5 @@
-BOOT = consolefont keymaps modules net.lo procfs
-DEFAULT = hdparm
+BOOT= consolefont keymaps modules net.lo procfs
+DEFAULT= hdparm
-TOPDIR = ..
-include $(TOPDIR)/runlevels.mk
-
-# vim: set ts=4 :
+MK= ../mk
+include ${MK}/runlevels.mk
diff --git a/runlevels.mk b/runlevels.mk
deleted file mode 100644
index 9794c480..00000000
--- a/runlevels.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# Handy runlevel stuff
-
-LEVELDIR = $(DESTDIR)/etc/runlevels
-BOOTDIR = $(LEVELDIR)/boot
-DEFAULTDIR = $(LEVELDIR)/default
-
-INSTALL ?= install
-
-install:
- if ! test -d "$(BOOTDIR)"; then \
- $(INSTALL) -d $(BOOTDIR) || exit $$?; \
- for x in $(BOOT); do ln -snf /etc/init.d/"$$x" $(BOOTDIR)/"$$x" || exit $$?; done \
- fi
- if ! test -d "$(DEFAULTDIR)"; then \
- $(INSTALL) -d $(DEFAULTDIR) || exit $$?; \
- for x in $(DEFAULT); do ln -snf /etc/init.d/"$$x" $(DEFAULTDIR)/"$$x" || exit $$?; done \
- fi
-
-all:
-clean:
-depend:
-
-# vim: set ts=4 :
diff --git a/runlevels/Makefile b/runlevels/Makefile
index 400e0003..5fe03721 100644
--- a/runlevels/Makefile
+++ b/runlevels/Makefile
@@ -1,11 +1,10 @@
-BOOT = bootmisc checkroot checkfs clock hostname localmount swap sysctl urandom
-DEFAULT = local netmount
+BOOT= bootmisc checkroot checkfs clock hostname localmount \
+ swap sysctl urandom
+DEFAULT= local netmount
-LEVELDIR = $(DESTDIR)/etc/runlevels
-BOOTDIR = $(LEVELDIR)/boot
-DEFAULTDIR = $(LEVELDIR)/default
+LEVELDIR= ${DESTDIR}/etc/runlevels
+BOOTDIR= ${LEVELDIR}/boot
+DEFAULTDIR= ${LEVELDIR}/default
-TOPDIR = ..
-include $(TOPDIR)/runlevels.mk
-
-# vim: set ts=4 :
+MK= ../mk
+include ${MK}/runlevels.mk
diff --git a/sh.BSD/Makefile b/sh.BSD/Makefile
index 19b68f36..3e5a37c1 100644
--- a/sh.BSD/Makefile
+++ b/sh.BSD/Makefile
@@ -1,5 +1,5 @@
-DIR = $(RC_LIB)/sh
-BIN = $(CONTENTS)
+DIR= ${RC_LIB}/sh
+BIN= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/sh.Linux/Makefile b/sh.Linux/Makefile
index 19b68f36..3e5a37c1 100644
--- a/sh.Linux/Makefile
+++ b/sh.Linux/Makefile
@@ -1,5 +1,5 @@
-DIR = $(RC_LIB)/sh
-BIN = $(CONTENTS)
+DIR= ${RC_LIB}/sh
+BIN= ${CONTENTS}
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
+include ${MK}/scripts.mk
diff --git a/sh/Makefile b/sh/Makefile
index 225d9f15..ff4d31b2 100644
--- a/sh/Makefile
+++ b/sh/Makefile
@@ -1,23 +1,26 @@
-DIR = $(RC_LIB)/sh
-INC = functions.sh init-common-post.sh rc-functions.sh rc-mount.sh
-BIN = gendepends.sh net.sh runscript.sh
+DIR= ${RC_LIB}/sh
+INC= functions.sh init-common-post.sh rc-functions.sh rc-mount.sh
+BIN= gendepends.sh net.sh runscript.sh
-TOPDIR = ..
-include $(TOPDIR)/default.mk
+MK= ../mk
# To get NET_LO
-include Makefile.$(OS)
+include ${MK}/os.mk
+include Makefile.${SUBOS}
-install::
+INSTALLAFTER= _installafter
+_installafter:
@# Handle lib correctly
- if test $(LIBNAME) != "lib"; then \
- sed -i'.bak' -e 's,/lib/,/$(LIBNAME)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$?; \
- rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak; \
- sed -i'.bak' -e 's,/lib/,/$(LIBNAME)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$?; \
- rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak; \
+ if test ${LIBNAME} != "lib"; then \
+ sed -i'.bak' -e 's,/lib/,/${LIBNAME}/,g' ${DESTDIR}/${RC_LIB}/sh/functions.sh || exit $$?; \
+ rm -f ${DESTDIR}/${RC_LIB}/sh/functions.sh.bak; \
+ sed -i'.bak' -e 's,/lib/,/${LIBNAME}/,g' ${DESTDIR}/${RC_LIB}/sh/rc-functions.sh || exit $$?; \
+ rm -f ${DESTDIR}/${RC_LIB}/sh/rc-functions.sh.bak; \
fi
@# Provide an init script for the loopback interface
- ln -snf $(RC_LIB)/sh/net.sh $(DESTDIR)/etc/init.d/$(NET_LO) || exit $$?
- @# Put functions.sh into the init.d dir so 3rd part apps don't have to
+ ln -snf ${RC_LIB}/sh/net.sh ${DESTDIR}/etc/init.d/${NET_LO} || exit $$?
+ @# Put functions.sh into the init.d dir so 3rd party apps don't have to
@# be multilib aware
- ln -snf $(RC_LIB)/sh/functions.sh $(DESTDIR)/etc/init.d || exit $$?
+ ln -snf ${RC_LIB}/sh/functions.sh ${DESTDIR}/etc/init.d || exit $$?
+
+include ${MK}/scripts.mk
diff --git a/src/Makefile b/src/Makefile
index 19922620..36a3b8e1 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,5 +2,5 @@
SUBDIR= libeinfo librc rc
-TOPDIR= ..
-include ${TOPDIR}/subdir.mk
+MK= ../mk
+include ${MK}/subdir.mk
diff --git a/src/hidden-visibility.h b/src/includes/hidden-visibility.h
index bc7e338a..bc7e338a 100644
--- a/src/hidden-visibility.h
+++ b/src/includes/hidden-visibility.h
diff --git a/src/rc-misc.h b/src/includes/rc-misc.h
index b7208e67..b7208e67 100644
--- a/src/rc-misc.h
+++ b/src/includes/rc-misc.h
diff --git a/src/strlist.h b/src/includes/strlist.h
index 3abe44ff..3abe44ff 100644
--- a/src/strlist.h
+++ b/src/includes/strlist.h
diff --git a/src/libeinfo/Makefile b/src/libeinfo/Makefile
index da12ef78..7ef84abb 100644
--- a/src/libeinfo/Makefile
+++ b/src/libeinfo/Makefile
@@ -1,16 +1,16 @@
-TOPDIR= ..
-include ${TOPDIR}/os.mk
+MK= ../../mk
+include ${MK}/os.mk
LIB= einfo
-SHLIB_MAJOR= 1
+SHLIB_MAJOR= 1
SRCS= libeinfo.c
INCS= einfo.h
-VERSION_MAP= einfo.map
+VERSION_MAP= einfo.map
SHLIBDIR= /${LIBNAME}
-CFLAGS+= -I${TOPDIR}
+CFLAGS+= -I../includes
-include ${TOPDIR}/cc.mk
-include ${TOPDIR}/lib.mk
-include ${TOPDIR}/${TERMCAP}.mk
+include ${MK}/cc.mk
+include ${MK}/lib.mk
+include ${MK}/${TERMCAP}.mk
diff --git a/src/librc/Makefile b/src/librc/Makefile
index 095988b8..888155b8 100644
--- a/src/librc/Makefile
+++ b/src/librc/Makefile
@@ -1,5 +1,5 @@
-TOPDIR= ..
-include ${TOPDIR}/os.mk
+MK= ../../mk
+include ${MK}/os.mk
LIB= rc
SHLIB_MAJOR= 1
@@ -11,9 +11,9 @@ VERSION_MAP= rc.map
CFLAGS+= -DLIB=\"${LIBNAME}\"
LDADD+= ${LIBKVM}
-CFLAGS+= -I${TOPDIR}
+CFLAGS+= -I../includes
SHLIBDIR= /${LIBNAME}
-include ${TOPDIR}/cc.mk
-include ${TOPDIR}/lib.mk
+include ${MK}/cc.mk
+include ${MK}/lib.mk
diff --git a/src/rc/Makefile b/src/rc/Makefile
index b6ae45a2..e804ec98 100644
--- a/src/rc/Makefile
+++ b/src/rc/Makefile
@@ -5,11 +5,9 @@ SRCS= checkpath.c fstabinfo.c mountinfo.c rc.c rc-depend.c \
CLEANFILES= version.h
-TOPDIR= ..
-
-LDFLAGS+= -L${TOPDIR}/librc -L${TOPDIR}/libeinfo
+LDFLAGS+= -L../librc -L../libeinfo
LDADD+= -lutil -lrc -leinfo
-CFLAGS+= -I${TOPDIR} -I${TOPDIR}/librc -I${TOPDIR}/libeinfo
+CFLAGS+= -I../includes -I../librc -I../libeinfo
BINDIR?= /sbin
@@ -32,18 +30,19 @@ RC_SBINLINKS= mark_service_starting mark_service_started \
mark_service_coldplugged mark_service_failed \
rc-abort
-include ${TOPDIR}/os.mk
+MK= ../../mk
+include ${MK}/os.mk
CFLAGS+= -DLIB=\"${LIBNAME}\"
-include ${TOPDIR}/cc.mk
-include ${TOPDIR}/prog.mk
+include ${MK}/cc.mk
+include ${MK}/prog.mk
-include ${TOPDIR}/${TERMCAP}.mk
+include ${MK}/${TERMCAP}.mk
LDADD+= ${LIBDL} ${LIBKVM}
-include ${TOPDIR}/${PAM}.mk
+include ${MK}/${PAM}.mk
${SRCS}: version.h
version.h:
- sed -n -e 's/^VERSION =[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1\"/p' ../../Makefile > version.h
+ sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1\"/p' ../../Makefile > version.h
if test -n "${BRANDING}"; then \
echo "#define BRANDING \"${BRANDING}\"" >> version.h; \
fi
@@ -54,7 +53,7 @@ install: all
${INSTALL} -d ${DESTDIR}/bin
for x in ${BINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}/bin/$$x; done
${INSTALL} -d ${DESTDIR}/bin
- for x in ${SBINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}${BINDIR}/$$x; done
+ for x in ${SBINLINKS}; do ln -fs ${PROG} ${DESTDIR}${BINDIR}/$$x; done
${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/bin
for x in $(RC_BINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)/${LIBNAME}/${PROG}/bin/$$x; done
${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/sbin
diff --git a/subdir.mk b/subdir.mk
deleted file mode 100644
index 86efca04..00000000
--- a/subdir.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# Recursive rules
-# Adapted from FreeBSDs bsd.subdir.mk
-_+_ ?= +
-ECHODIR ?= echo
-_SUBDIR = @${_+_}for x in ${SUBDIR}; do \
- if test -d $$x; then \
- ${ECHODIR} "===> ${DIRPRFX}$$x ($@)"; \
- cd $$x; \
- ${MAKE} $@ DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
- cd ..; \
- fi; \
- if test -d $$x.${OS}; then \
- ${ECHODIR} "===> ${DIRPRFX}$$x.${OS} ($@)"; \
- cd $$x.${OS}; \
- ${MAKE} $@ DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
- cd ..; \
- fi; \
-done
-
-all:
- ${_SUBDIR}
-clean:
- ${_SUBDIR}
-install:
- ${_SUBDIR}
-depend:
- ${_SUBDIR}