diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-10-19 21:30:39 -0400 |
---|---|---|
committer | William Hubbs <williamh@gentoo.org> | 2011-10-20 14:32:37 -0500 |
commit | 9a539ebbe1ee0c8557fbcdf22e849534dcbd9b53 (patch) | |
tree | 9936901aa8c8231d49145894456ff6f40a74c0ae | |
parent | 9c77502f964ef368892598b4fb30c4909fe3d360 (diff) |
further clean up OS differences in makefiles
No need for if() logic.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | conf.d/Makefile | 27 | ||||
-rw-r--r-- | conf.d/network.BSD.in (renamed from conf.d/network.BSD) | 0 | ||||
-rw-r--r-- | conf.d/network.Linux.in (renamed from conf.d/network.Linux) | 0 | ||||
-rw-r--r-- | conf.d/staticroute.BSD.in (renamed from conf.d/staticroute.BSD) | 0 | ||||
-rw-r--r-- | conf.d/staticroute.Linux.in (renamed from conf.d/staticroute.Linux) | 0 | ||||
-rw-r--r-- | doc/Makefile | 20 | ||||
-rw-r--r-- | etc/Makefile | 30 | ||||
-rw-r--r-- | init.d.misc/Makefile | 9 | ||||
-rw-r--r-- | init.d/Makefile | 46 | ||||
-rw-r--r-- | mk/os-BSD.mk | 3 | ||||
-rw-r--r-- | mk/os-Linux.mk | 3 | ||||
-rw-r--r-- | mk/os.mk | 2 | ||||
-rw-r--r-- | net/Makefile | 28 | ||||
-rw-r--r-- | runlevels/Makefile | 35 | ||||
-rw-r--r-- | sh/Makefile | 37 |
15 files changed, 92 insertions, 148 deletions
diff --git a/conf.d/Makefile b/conf.d/Makefile index 5af2592b..d5f85c30 100644 --- a/conf.d/Makefile +++ b/conf.d/Makefile @@ -1,5 +1,6 @@ DIR= ${CONFDIR} -CONF= bootmisc fsck hostname localmount network staticroute urandom +CONF= bootmisc fsck hostname localmount network staticroute urandom \ + ${CONF-${OS}} TARGETS+= network staticroute CLEANFILES+= network staticroute @@ -7,22 +8,16 @@ CLEANFILES+= network staticroute MK= ../mk include ${MK}/os.mk -ifeq (${OS},FreeBSD) -CONF+= ipfw moused powerd rarpd savecore syscons -else ifeq (${OS},Linux) -CONF+= consolefont dmesg hwclock keymaps killprocs modules -SOS= Linux -else ifeq (${OS},NetBSD) -CONF+= moused rarpd savecore -endif +CONF-FreeBSD= ipfw moused powerd rarpd savecore syscons -include ${MK}/scripts.mk +CONF-Linux= consolefont dmesg hwclock keymaps killprocs modules + +CONF-NetBSD= moused rarpd savecore -SOS?= BSD +include ${MK}/scripts.mk -network: network.in network.${SOS} - cp $@.in $@ - [ -e $@.${SOS} ] && cat $@.${SOS} >> $@ || true +network: network.in network${SFX} + cat $^ > $@ -staticroute: staticroute.${SOS} - cp $@.${SOS} $@ +staticroute: staticroute${SFX} + cp $@${SFX} $@ diff --git a/conf.d/network.BSD b/conf.d/network.BSD.in index 9f49b81a..9f49b81a 100644 --- a/conf.d/network.BSD +++ b/conf.d/network.BSD.in diff --git a/conf.d/network.Linux b/conf.d/network.Linux.in index f57ec91a..f57ec91a 100644 --- a/conf.d/network.Linux +++ b/conf.d/network.Linux.in diff --git a/conf.d/staticroute.BSD b/conf.d/staticroute.BSD.in index 47984733..47984733 100644 --- a/conf.d/staticroute.BSD +++ b/conf.d/staticroute.BSD.in diff --git a/conf.d/staticroute.Linux b/conf.d/staticroute.Linux.in index 68d22eb4..68d22eb4 100644 --- a/conf.d/staticroute.Linux +++ b/conf.d/staticroute.Linux.in diff --git a/doc/Makefile b/doc/Makefile index 4fbc99ce..81e621ba 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,27 +1,11 @@ DIR= ${DOCDIR}/openrc +SRCS= net.example.in INC= net.example MK= ../mk include ${MK}/os.mk -ifeq (${OS},FreeBSD) -SRCS+= net.example.in - -.SUFFIXES: .BSD.in -.BSD.in: - ${CP} $< $@ -else ifeq (${OS},Linux) -SRCS+= net.example.in - -.SUFFIXES: .Linux.in -.Linux.in: - ${CP} $< $@ -else ifeq (${OS},NetBSD) -SRCS+= net.example.in - -.SUFFIXES: .BSD.in -.BSD.in: +${SFX}: ${CP} $< $@ -endif include ${MK}/scripts.mk diff --git a/etc/Makefile b/etc/Makefile index a7976b6a..8bcf19ba 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,24 +1,26 @@ DIR= ${SYSCONFDIR} -CONF= rc.conf +SRCS= rc.conf.in rc.in rc.shutdown.in +BIN= ${BIN-${OS}} +CONF= rc.conf ${BIN-${OS}} CLEANFILES+= rc.conf MK= ../mk include ${MK}/os.mk -ifeq (${OS},FreeBSD) -SED_EXTRA= -e 's:@TERM@:cons25:g' -SRCS+= rc.conf.in rc.in rc.shutdown.in -CONF+= devd.conf -BIN+= rc rc.shutdown rc.devd -else ifeq (${OS},Linux) -SED_EXTRA= -e 's:@TERM@:wsvt25:g' -SRCS+= rc.conf.in rc.in rc.shutdown.in -else ifeq (${OS},NetBSD) -SED_EXTRA= -e 's:@TERM@:wsvt25:g' -SRCS+= rc.conf.in rc.in rc.shutdown.in -BIN+= rc rc.shutdown -endif +SED_EXTRA-FreeBSD= -e 's:@TERM@:cons25:g' +BIN-FreeBSD= rc rc.shutdown rc.devd +CONF-FreeBSD= devd.conf + +SED_EXTRA-Linux= -e 's:@TERM@:wsvt25:g' +BIN-Linux= +CONF-Linux= + +SED_EXTRA-NetBSD= -e 's:@TERM@:wsvt25:g' +BIN-NetBSD= rc rc.shutdown +CONF-NetBSD= + +SED_EXTRA= ${SED_EXTRA-${OS}} include ${MK}/scripts.mk diff --git a/init.d.misc/Makefile b/init.d.misc/Makefile index b44063cc..ce973c1b 100644 --- a/init.d.misc/Makefile +++ b/init.d.misc/Makefile @@ -7,12 +7,5 @@ MK= ../mk SED_EXTRA+= -e 's:@VARBASE@:/var:g' +include ${MK}/os.mk include ${MK}/scripts.mk - -ifeq ($(OS),FreeBSD) -PKG_PREFIX?= /usr/local -else ifeq ($(OS),Linux) -PKG_PREFIX?=/usr -else ifeq ($(OS),NetBSD) -PKG_PREFIX?= /usr/pkg -endif diff --git a/init.d/Makefile b/init.d/Makefile index 5fd33310..db681549 100644 --- a/init.d/Makefile +++ b/init.d/Makefile @@ -1,7 +1,7 @@ DIR= ${INITDIR} SRCS= bootmisc.in fsck.in hostname.in local.in localmount.in netmount.in \ network.in root.in savecache.in staticroute.in swap.in swclock.in \ - sysctl.in urandom.in + sysctl.in urandom.in ${SRCS-${OS}} BIN= ${OBJS} # Build our old net foo or not @@ -17,44 +17,28 @@ TARGETS+= ${_NET_LO} MK= ../mk include ${MK}/os.mk -ifeq ($(OS),FreeBSD) -NET_LO= net.lo0 - +NET_LO-FreeBSD= net.lo0 # Generic BSD scripts -SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ - rpcbind.in savecore.in syslogd.in - +SRCS-FreeBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ + rpcbind.in savecore.in syslogd.in # These are FreeBSD specific -SRCS+= adjkerntz.in devd.in dumpon.in ipfw.in mixer.in nscd.in \ - powerd.in syscons.in - -.SUFFIXES: .BSD.in -.BSD.in: - sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ -else ifeq ($(OS),Linux) -NET_LO= net.lo +SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in ipfw.in mixer.in nscd.in \ + powerd.in syscons.in -SRCS+= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in killprocs.in \ - modules.in mount-ro.in mtab.in numlock.in procfs.in sysfs.in \ - termencoding.in - -.SUFFIXES: .Linux.in -.Linux.in: - sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ -else ifeq ($(OS),NetBSD) -NET_LO= net.lo0 +NET_LO-Linux= net.lo +SRCS-Linux= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in \ + killprocs.in modules.in mount-ro.in mtab.in numlock.in \ + procfs.in sysfs.in termencoding.in +NET_LO-NetBSD= net.lo0 # Generic BSD scripts -SRCS+= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ - rpcbind.in savecore.in syslogd.in - +SRCS-NetBSD= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \ + rpcbind.in savecore.in syslogd.in # These are NetBSD specific -SRCS+= devdb.in swap-blk.in ttys.in wscons.in +SRCS-NetBSD+= devdb.in swap-blk.in ttys.in wscons.in -.SUFFIXES: .BSD.in -.BSD.in: +${SFX}: sed ${SED_REPLACE} ${SED_EXTRA} $< > $@ -endif include ${MK}/scripts.mk diff --git a/mk/os-BSD.mk b/mk/os-BSD.mk index 0b19afb1..fbcd3710 100644 --- a/mk/os-BSD.mk +++ b/mk/os-BSD.mk @@ -3,4 +3,7 @@ # Generic definitions +PKG_PREFIX?= /usr/local +SFX= .BSD.in + LIBKVM?= -lkvm diff --git a/mk/os-Linux.mk b/mk/os-Linux.mk index 7da0ed9c..bdd12031 100644 --- a/mk/os-Linux.mk +++ b/mk/os-Linux.mk @@ -1,5 +1,8 @@ # Copyright (c) 2008 Roy Marples <roy@marples.name> # Released under the 2-clause BSD license. +SFX= .Linux.in +PKG_PREFIX?= /usr + CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=600 LIBDL= -Wl,-Bdynamic -ldl @@ -10,3 +10,5 @@ include ${MK}/os-${OS}.mk RC_LIB= /$(LIBNAME)/rc +SFX:= ${SFX_PFX}${SFX} +.SUFFIXES: ${SFX} diff --git a/net/Makefile b/net/Makefile index f783e40a..664800df 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1,34 +1,24 @@ DIR= ${LIBEXECDIR}/net -SRCS= ifconfig.sh.in +SRCS= ifconfig.sh.in ${SRCS-${OS}} INC= dhclient.sh dhcpcd.sh ifconfig.sh macchanger.sh macnet.sh \ - ssidnet.sh system.sh wpa_supplicant.sh + ssidnet.sh system.sh wpa_supplicant.sh ${INC-${OS}} MK= ../mk include ${MK}/os.mk -ifeq (${OS},FreeBSD) -SRCS+= iwconfig.sh.in -INC+= iwconfig.sh +SRCS-FreeBSD= iwconfig.sh.in +INC-FreeBSD= iwconfig.sh -.SUFFIXES: .sh.BSD.in -.sh.BSD.in.sh: - ${CP} $< $@ -else ifeq (${OS},Linux) -SRCS+= iwconfig.sh.in -INC+= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \ +SRCS-Linux= iwconfig.sh.in +INC-Linux= adsl.sh apipa.sh arping.sh bonding.sh br2684ctl.sh bridge.sh \ ccwgroup.sh clip.sh ethtool.sh iproute2.sh ifplugd.sh ip6to4.sh \ ipppd.sh iwconfig.sh netplugd.sh pppd.sh pump.sh tuntap.sh udhcpc.sh \ vlan.sh -.SUFFIXES: .sh.Linux.in -.sh.Linux.in.sh: - ${CP} $< $@ -else ifeq (${OS},NetBSD) -INC+= ifwatchd.sh +SRCS-NetBSD= +INC-NetBSD= ifwatchd.sh -.SUFFIXES: .sh.BSD.in -.sh.BSD.in.sh: +${SFX}.sh: ${CP} $< $@ -endif include ${MK}/scripts.mk diff --git a/runlevels/Makefile b/runlevels/Makefile index 1f9f9aaf..f454950d 100644 --- a/runlevels/Makefile +++ b/runlevels/Makefile @@ -1,7 +1,8 @@ BOOT= bootmisc fsck hostname localmount network \ - root staticroute swap sysctl urandom + root staticroute swap sysctl urandom ${BOOT-${OS}} DEFAULT= local netmount -SHUTDOWN= savecache +SHUTDOWN= savecache ${SHUTDOWN-${OS}} +SYSINIT= ${SYSINIT-${OS}} LEVELDIR= ${DESTDIR}/${SYSCONFDIR}/runlevels SYSINITDIR= ${LEVELDIR}/sysinit @@ -16,25 +17,25 @@ include ${MK}/sys.mk include ${MK}/os.mk include ${MK}/gitignore.mk -ifeq (${OS},BSD) -BOOT+= hostid newsyslog savecore syslogd swap-blk -else ifeq (${OS},FreeBSD) -# Generic BSD stuff -BOOT+= hostid net.lo0 newsyslog savecore syslogd +BOOT-${OS}= +SHUTDOWN-${OS}= +SYSINIT-${OS}= + +BOOT-BSD= hostid newsyslog savecore syslogd swap-blk -# FreeBSD specific stuff -BOOT+= adjkerntz dumpon syscons -else ifeq (${OS},Linux) -SYSINIT+= devfs dmesg -BOOT+= hwclock keymaps modules mtab procfs termencoding -SHUTDOWN+= killprocs mount-ro -else ifeq (${OS},NetBSD) # Generic BSD stuff -BOOT+= hostid net.lo0 newsyslog savecore syslogd +BOOT-FreeBSD= hostid net.lo0 newsyslog savecore syslogd +# FreeBSD specific stuff +BOOT-FreeBSD+= adjkerntz dumpon syscons + +BOOT-Linux= hwclock keymaps modules mtab procfs termencoding +SHUTDOWN-Linux= killprocs mount-ro +SYSINIT-Linux= devfs dmesg +# Generic BSD stuff +BOOT-NetBSD= hostid net.lo0 newsyslog savecore syslogd # NetBSD specific stuff -BOOT+= devdb swap-blk ttys wscons -endif +BOOT-NetBSD+= devdb swap-blk ttys wscons all: diff --git a/sh/Makefile b/sh/Makefile index c29462e3..c15c79e0 100644 --- a/sh/Makefile +++ b/sh/Makefile @@ -1,41 +1,28 @@ DIR= ${LIBEXECDIR}/sh -SRCS= functions.sh.in gendepends.sh.in init-common-post.sh.in \ - rc-functions.sh.in runscript.sh.in +SRCS= init.sh.in functions.sh.in gendepends.sh.in init-common-post.sh.in \ + rc-functions.sh.in runscript.sh.in ${SRCS-${OS}} INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh -BIN= gendepends.sh init.sh runscript.sh +BIN= gendepends.sh init.sh runscript.sh ${BIN-${OS}} INSTALLAFTER= _installafter +SFX_PFX= .sh MK= ../mk include ${MK}/os.mk -ifeq (${OS},FreeBSD) -SRCS+= init.sh.in +SRCS-FreeBSD= +BIN-FreeBSD= -.SUFFIXES: .sh.BSD.in -.sh.BSD.in.sh: - ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ - -else ifeq (${OS},Linux) -SRCS+= init.sh.in init-early.sh.in udhcpc-hook.sh.in -BIN+= init-early.sh udhcpc-hook.sh - -.SUFFIXES: .sh.Linux.in -.sh.Linux.in.sh: - ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ +SRCS-Linux= init-early.sh.in udhcpc-hook.sh.in +BIN-Linux= init-early.sh udhcpc-hook.sh -else ifeq (${OS},NetBSD) -SRCS+= init.sh.in +SRCS-NetBSD= ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in +BIN-NetBSD= ifwatchd-carrier.sh ifwatchd-nocarrier.sh -SRCS+= ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in -BIN+= ifwatchd-carrier.sh ifwatchd-nocarrier.sh +include ${MK}/scripts.mk -.SUFFIXES: .sh.BSD.in -.sh.BSD.in.sh: +${SFX}.sh: ${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@ -endif - -include ${MK}/scripts.mk _installafter: ${INSTALL} -d ${DESTDIR}/${INITDIR} |