diff options
-rw-r--r-- | Makefile | 17 | ||||
-rw-r--r-- | Makefile.BSD | 1 | ||||
-rw-r--r-- | Makefile.Linux | 1 | ||||
-rw-r--r-- | conf.d.BSD/Makefile | 2 | ||||
-rw-r--r-- | conf.d.Linux/Makefile | 5 | ||||
-rw-r--r-- | conf.d/Makefile | 5 | ||||
-rw-r--r-- | default.mk | 79 | ||||
-rw-r--r-- | init.d.BSD/Makefile | 4 | ||||
-rw-r--r-- | init.d.Linux/Makefile | 4 | ||||
-rw-r--r-- | init.d/Makefile | 6 | ||||
-rw-r--r-- | man/Makefile | 4 | ||||
-rw-r--r-- | net.BSD/Makefile | 4 | ||||
-rw-r--r-- | net.Linux/Makefile | 10 | ||||
-rw-r--r-- | net/Makefile | 6 | ||||
-rw-r--r-- | runlevels.Linux/Makefile | 8 | ||||
-rw-r--r-- | runlevels/Makefile | 8 | ||||
-rw-r--r-- | sh.BSD/Makefile | 4 | ||||
-rw-r--r-- | sh.Linux/Makefile | 4 | ||||
-rw-r--r-- | sh/Makefile | 8 | ||||
-rw-r--r-- | src/Makefile | 15 |
20 files changed, 91 insertions, 104 deletions
@@ -3,25 +3,14 @@ # Distributed under the terms of the GNU General Public License v2 NAME = openrc -VERSION = 1.0pre1 +VERSION = 1.0 PKG = $(NAME)-$(VERSION) -SUBDIRS = etc conf.d init.d man net sh src - -ifeq ($(OS),) -OS=$(shell uname -s) -ifneq ($(OS),Linux) -OS=BSD -endif -endif - -NET_LO = net.lo0 -ifeq ($(OS),Linux) - NET_LO = net.lo -endif +SUBDIR = conf.d etc init.d man net sh src TOPDIR = . include $(TOPDIR)/default.mk +include $(TOPDIR)/Makefile.$(OS) install:: # Don't install runlevels if they already exist diff --git a/Makefile.BSD b/Makefile.BSD new file mode 100644 index 00000000..f1e45618 --- /dev/null +++ b/Makefile.BSD @@ -0,0 +1 @@ +NET_LO = net.lo0 diff --git a/Makefile.Linux b/Makefile.Linux new file mode 100644 index 00000000..219c92fb --- /dev/null +++ b/Makefile.Linux @@ -0,0 +1 @@ +NET_LO = net.lo diff --git a/conf.d.BSD/Makefile b/conf.d.BSD/Makefile index 29aa2212..e7e8a46f 100644 --- a/conf.d.BSD/Makefile +++ b/conf.d.BSD/Makefile @@ -1,5 +1,5 @@ DIR = /etc/conf.d -FILES = localmount net.example +CONF = localmount net.example TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/conf.d.Linux/Makefile b/conf.d.Linux/Makefile index cca715e8..40cbc172 100644 --- a/conf.d.Linux/Makefile +++ b/conf.d.Linux/Makefile @@ -1,7 +1,6 @@ DIR = /etc/conf.d -FILES = net.example -FILES_APPEND = clock rc -FILES_NOEXIST = consolefont keymaps +CONF = consolefont keymaps net.example +CONF_APPEND = clock rc TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/conf.d/Makefile b/conf.d/Makefile index 278910fb..cce63f66 100644 --- a/conf.d/Makefile +++ b/conf.d/Makefile @@ -1,5 +1,6 @@ -DIR = /etc/conf.d -FILES_NOEXIST = $(filter-out Makefile,$(wildcard *)) +DIR = /etc/conf.d +CONF = bootmisc checkfs clock env_whitelist hostname local.start local.stop \ + net rc urandom TOPDIR = .. include $(TOPDIR)/default.mk @@ -6,50 +6,51 @@ ROOT = / LIB = lib RC_LIB = /$(LIB)/rc -# -# Recursive rules -# - -SUBDIRS_ALL = $(patsubst %,%_all,$(SUBDIRS)) -SUBDIRS_CLEAN = $(patsubst %,%_clean,$(SUBDIRS)) -SUBDIRS_INSTALL = $(patsubst %,%_install,$(SUBDIRS)) - -all:: $(SUBDIRS_ALL) -clean:: $(SUBDIRS_CLEAN) -install:: $(SUBDIRS_INSTALL) - -# Hmm ... possible to combine these three and not be ugly ? -%_all: - if test -d $(patsubst %_all,%,$@); then $(MAKE) -C $(patsubst %_all,%,$@).$(OS) all; fi - if test -d $(patsubst %_all,%,$@).$(OS); then $(MAKE) -C $(patsubst %_all,%,$@).$(OS) all; fi -%_clean: - if test -d $(patsubst %_clean,%,$@) ; then $(MAKE) -C $(patsubst %_clean,%,$@) clean ; fi - if test -d $(patsubst %_clean,%,$@).$(OS) ; then $(MAKE) -C $(patsubst %_clean,%,$@).$(OS) clean ; fi -%_install: - if test -d $(patsubst %_install,%,$@) ; then $(MAKE) -C $(patsubst %_install,%,$@) install ; fi - if test -d $(patsubst %_install,%,$@).$(OS) ; then $(MAKE) -C $(patsubst %_install,%,$@).$(OS) install ; fi +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)) # -# Install rules +# Recursive rules +# Adapted from FreeBSDs bsd.subdir.mk # +ECHODIR ?= true +_SUBDIR = \ + @for x in $(SUBDIR); do \ + if test -d $$x; then \ + ${ECHODIR} "===> ${DIRPRFX}$$x ($@)"; \ + ${MAKE} -C $$x $@ DIRPRFX=${DIRPRFX}$$x/; \ + fi; \ + if test -d $$x.${OS}; then \ + ${ECHODIR} "===> ${DIRPRFX}$$x.${OS} ($@)"; \ + ${MAKE} -C $$x.${OS} $@ DIRPRFX=${DIRPRFX}$$x/; \ + fi; \ + done -INSTALL_DIR = install -m 0755 -d -INSTALL_EXE = install -m 0755 -INSTALL_FILE = install -m 0644 -INSTALL_SECURE = install -m 0600 - -install:: $(EXES) $(FILES) $(FILES_NOEXIST) $(MANS) - test -n $(DIR) && $(INSTALL_DIR) $(DESTDIR)$(DIR) - for x in $(EXES) ; do $(INSTALL_EXE) $$x $(DESTDIR)$(DIR) || exit $$? ; done - for x in $(FILES) ; do $(INSTALL_FILE) $$x $(DESTDIR)$(DIR) || exit $$? ; done - for x in $(FILES_APPEND) ; do if test -e $(DESTDIR)$(DIR)/$$x ; then cat $$x >> $(DESTDIR)$(DIR)/$$x || exit $$? ; else $(INSTALL_FILE) $$x $(DESTDIR)$(DIR) || exit $$? ; fi ; done - for x in $(FILES_NOEXIST) ; do if ! test -e $(DESTDIR)$(DIR)/$$x ; then $(INSTALL_FILE) $$x $(DESTDIR)$(DIR) || exit $$? ; fi ; done - for x in $(FILES_SECURE) ; do $(INSTALL_SECURE) $$x $(DESTDIR)$(DIR) || exit $$? ; done - for x in $(MANS) ; do \ - ext=`echo $$x | sed -e 's/^.*\\.//'` ; \ - $(INSTALL_DIR) $(DESTDIR)$(DIR)/man$$ext || exit $$? ; \ - $(INSTALL_FILE) $$x $(DESTDIR)$(DIR)/man$$ext || exit $$? ; \ +all: + $(_SUBDIR) +clean:: + $(_SUBDIR) +install:: + $(_SUBDIR) + +install:: $(BIN) $(CONF) $(CONF_APPEND) $(MAN8) + 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 "$(CONF)" ; then $(INSTALL) -m 0644 $(CONF) $(DESTDIR)$(DIR) || exit $$?; fi + for x in $(CONF_APPEND) ; 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 .PHONY: all clean install diff --git a/init.d.BSD/Makefile b/init.d.BSD/Makefile index 0808c286..b15b007b 100644 --- a/init.d.BSD/Makefile +++ b/init.d.BSD/Makefile @@ -1,5 +1,5 @@ -DIR = /etc/init.d -EXES = clock +DIR = /etc/init.d +BIN = clock TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/init.d.Linux/Makefile b/init.d.Linux/Makefile index b8328d22..48ad03f7 100644 --- a/init.d.Linux/Makefile +++ b/init.d.Linux/Makefile @@ -1,5 +1,5 @@ -DIR = /etc/init.d -EXES = clock consolefont keymaps modules numlock +DIR = /etc/init.d +BIN = clock consolefont keymaps modules numlock TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/init.d/Makefile b/init.d/Makefile index c86468ac..19f5fb43 100644 --- a/init.d/Makefile +++ b/init.d/Makefile @@ -1,6 +1,6 @@ -DIR = /etc/init.d -EXES = bootmisc checkfs checkroot hostname local localmount \ - netmount rmnologin urandom halt.sh +DIR = /etc/init.d +BIN = bootmisc checkfs checkroot hostname local localmount \ + netmount rmnologin urandom halt.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/man/Makefile b/man/Makefile index ab9803b7..b3f49216 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,5 +1,5 @@ -DIR = /usr/share/man -MANS = rc-status.8 rc-update.8 start-stop-daemon.8 +DIR = /usr/share/man/man8 +CONF = rc-status.8 rc-update.8 start-stop-daemon.8 TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/net.BSD/Makefile b/net.BSD/Makefile index c000a354..cb5d2077 100644 --- a/net.BSD/Makefile +++ b/net.BSD/Makefile @@ -1,5 +1,5 @@ -DIR = $(RC_LIB)/net -FILES = ifconfig.sh iwconfig.sh +DIR = $(RC_LIB)/net +CONF = ifconfig.sh iwconfig.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/net.Linux/Makefile b/net.Linux/Makefile index a1472747..40c40f2d 100644 --- a/net.Linux/Makefile +++ b/net.Linux/Makefile @@ -1,8 +1,8 @@ -DIR = $(RC_LIB)/net -FILES = adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \ - ccwgroup.sh clip.sh ifconfig.sh ifplugd.sh ip6to4.sh ipppd.sh \ - iproute2.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh \ - udhcpc.sh vlan.sh +DIR = $(RC_LIB)/net +CONF = adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \ + ccwgroup.sh clip.sh ifconfig.sh ifplugd.sh ip6to4.sh ipppd.sh \ + iproute2.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh \ + udhcpc.sh vlan.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/net/Makefile b/net/Makefile index 0aedc1cc..017f4e5d 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1,6 +1,6 @@ -DIR = $(RC_LIB)/net -FILES = dhclient.sh dhcpcd.sh macchanger.sh macnet.sh ssidnet.sh system.sh \ - wpa_supplicant.sh +DIR = $(RC_LIB)/net +CONF = dhclient.sh dhcpcd.sh macchanger.sh macnet.sh ssidnet.sh system.sh \ + wpa_supplicant.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/runlevels.Linux/Makefile b/runlevels.Linux/Makefile index ef2e44fb..3fe69d83 100644 --- a/runlevels.Linux/Makefile +++ b/runlevels.Linux/Makefile @@ -2,10 +2,10 @@ BOOT = consolefont keymaps modules net.lo DEFAULT = hdparm install: - install -d -m 0755 $(DESTDIR)/etc/runlevels/boot || exit $$? ; \ - for x in $(BOOT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/boot/"$$x" || exit $$? ; done ; \ - install -d -m 0755 $(DESTDIR)/etc/runlevels/default || exit $$? ; \ - for x in $(DEFAULT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/default/"$$x" || exit $$? ; done ; \ + install -d -m 0755 $(DESTDIR)/etc/runlevels/boot || exit $$? + for x in $(BOOT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/boot/"$$x" || exit $$? ; done + install -d -m 0755 $(DESTDIR)/etc/runlevels/default || exit $$? + for x in $(DEFAULT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/default/"$$x" || exit $$? ; done .PHONY: all clean diff --git a/runlevels/Makefile b/runlevels/Makefile index 0cc60ed3..79041eca 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -2,10 +2,10 @@ BOOT = bootmisc checkroot checkfs clock hostname localmount rmnologin urandom DEFAULT = local netmount install: - install -d -m 0755 $(DESTDIR)/etc/runlevels/boot || exit $$? ; \ - for x in $(BOOT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/boot/"$$x" || exit $$? ; done ; \ - install -d -m 0755 $(DESTDIR)/etc/runlevels/default || exit $$? ; \ - for x in $(DEFAULT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/default/"$$x" || exit $$? ; done ; \ + install -d -m 0755 $(DESTDIR)/etc/runlevels/boot || exit $$? + for x in $(BOOT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/boot/"$$x" || exit $$? ; done + install -d -m 0755 $(DESTDIR)/etc/runlevels/default || exit $$? + for x in $(DEFAULT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/default/"$$x" || exit $$? ; done .PHONY: all clean diff --git a/sh.BSD/Makefile b/sh.BSD/Makefile index 485de3a7..ec4ffa27 100644 --- a/sh.BSD/Makefile +++ b/sh.BSD/Makefile @@ -1,5 +1,5 @@ -DIR = $(RC_LIB)/sh -EXES = init.sh +DIR = $(RC_LIB)/sh +BIN = init.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/sh.Linux/Makefile b/sh.Linux/Makefile index 89cd8154..b6592c4b 100644 --- a/sh.Linux/Makefile +++ b/sh.Linux/Makefile @@ -1,5 +1,5 @@ -DIR = $(RC_LIB)/sh -EXES = init.sh init-early.sh +DIR = $(RC_LIB)/sh +BIN = init.sh init-early.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/sh/Makefile b/sh/Makefile index aa9a4b45..0be6c650 100644 --- a/sh/Makefile +++ b/sh/Makefile @@ -1,7 +1,7 @@ -DIR = $(RC_LIB)/sh -FILES = functions.sh init-functions.sh init-common-post.sh \ - rc-functions.sh rc-mount.sh -EXES = gendepends.sh net.sh rc-mount.sh rc-help.sh runscript.sh +DIR = $(RC_LIB)/sh +CONF = functions.sh init-functions.sh init-common-post.sh \ + rc-functions.sh rc-mount.sh +BIN = gendepends.sh net.sh rc-mount.sh rc-help.sh runscript.sh TOPDIR = .. include $(TOPDIR)/default.mk diff --git a/src/Makefile b/src/Makefile index 90e23153..0e449194 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,7 +10,7 @@ # that works with GNU make and vice versa. NetBSD and OpenBSD makes do. # You can get a patch from # http://www.freebsd.org/cgi/query-pr.cgi?pr=standards/116081 -# to fix this. We include this patch with Gentoo/FreeBSD :) +# to fix this. CC ?= gcc CFLAGS += -O2 -pipe @@ -39,10 +39,6 @@ CFLAGS += -pedantic -std=c99 \ # For debugging. -Werror is pointless due to ISO C issues with dlsym #CFLAGS += -ggdb -DESTDIR = -LIB = lib -RC_LIB = /$(LIB)/rc - # Set PAM = pam for pam support PAM = @@ -98,9 +94,8 @@ CPPFLAGS += -DLIB=\"$(LIB)\" LDFLAGS += -Wl,-rpath . # Load an optional OS Makefile -_OS_SH = u=`uname -s`; case "$${u}" in *BSD|DragonFly) echo "BSD";; *) echo "$${u}";; esac -_OS != $(_OS_SH) -OS ?= $(_OS)$(shell $(_OS_SH)) +TOPDIR = .. +include $(TOPDIR)/default.mk include Makefile.$(OS) include Makefile.$(PAM) @@ -137,7 +132,7 @@ $(ALL_LINKS): rc ln -sf rc $@ links: $(ALL_LINKS) -install: $(TARGET) +install:: $(TARGET) install -m 0755 -d $(DESTDIR)/$(LIB) install -m 0755 $(LIB_TARGETS) $(DESTDIR)/$(LIB) install -m 0755 -d $(DESTDIR)/usr/$(LIB) @@ -165,7 +160,7 @@ install: $(TARGET) clean-links: rm -f $(ALL_LINKS) -clean: clean-links +clean:: echo > .depend touch -r Makefile .depend rm -f $(TARGET) |