Move runlevel and lib logic to the sub Makefiles
This commit is contained in:
parent
81715c3159
commit
88ccccc22a
18
Makefile
18
Makefile
@ -6,29 +6,15 @@ NAME = openrc
|
|||||||
VERSION = 1.0
|
VERSION = 1.0
|
||||||
PKG = $(NAME)-$(VERSION)
|
PKG = $(NAME)-$(VERSION)
|
||||||
|
|
||||||
SUBDIR = conf.d etc init.d man net sh src
|
SUBDIR = conf.d etc init.d man net runlevels sh src
|
||||||
|
|
||||||
TOPDIR = .
|
TOPDIR = .
|
||||||
include $(TOPDIR)/default.mk
|
include $(TOPDIR)/default.mk
|
||||||
include $(TOPDIR)/Makefile.$(OS)
|
include $(TOPDIR)/Makefile.$(OS)
|
||||||
|
|
||||||
install::
|
install::
|
||||||
# Don't install runlevels if they already exist
|
|
||||||
if ! test -d $(DESTDIR)/etc/runlevels ; then \
|
|
||||||
(cd runlevels; $(MAKE) install) ; \
|
|
||||||
test -d runlevels.$(OS) && (cd runlevels.$(OS); $(MAKE) install) ; \
|
|
||||||
$(INSTALL_DIR) $(DESTDIR)/etc/runlevels/single || exit $$? ; \
|
|
||||||
$(INSTALL_DIR) $(DESTDIR)/etc/runlevels/nonetwork || exit $$? ; \
|
|
||||||
fi
|
|
||||||
ln -snf ../../$(RC_LIB)/sh/net.sh $(DESTDIR)/etc/init.d/$(NET_LO) || exit $$?
|
ln -snf ../../$(RC_LIB)/sh/net.sh $(DESTDIR)/etc/init.d/$(NET_LO) || exit $$?
|
||||||
ln -snf ../../$(RC_LIB)/sh/functions.sh $(DESTDIR)/etc/init.d || exit $$?
|
ln -snf ../../$(RC_LIB)/sh/functions.sh $(DESTDIR)/etc/init.d || exit $$?
|
||||||
# Handle lib correctly
|
|
||||||
if test $(LIB) != "lib" ; then \
|
|
||||||
sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$? ; \
|
|
||||||
rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak ; \
|
|
||||||
sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$? ; \
|
|
||||||
rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
diststatus:
|
diststatus:
|
||||||
if test -d .svn ; then \
|
if test -d .svn ; then \
|
||||||
@ -51,6 +37,4 @@ distit:
|
|||||||
|
|
||||||
dist: diststatus distit
|
dist: diststatus distit
|
||||||
|
|
||||||
.PHONY: layout dist distit diststatus
|
|
||||||
|
|
||||||
# vim: set ts=4 :
|
# vim: set ts=4 :
|
||||||
|
@ -33,21 +33,18 @@ clean::
|
|||||||
install::
|
install::
|
||||||
$(_SUBDIR)
|
$(_SUBDIR)
|
||||||
|
|
||||||
install:: $(BIN) $(CONF) $(CONF_APPEND) $(MAN8)
|
install:: $(BIN) $(CONF) $(CONF_APPEND)
|
||||||
if test -n "$(DIR)" ; then $(INSTALL) -d $(DESTDIR)$(DIR) || exit $$?; fi
|
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 "$(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); do \
|
||||||
for x in $(CONF_APPEND) ; do \
|
|
||||||
if ! test -e $(DESTDIR)$(DIR)/$$x; then \
|
if ! test -e $(DESTDIR)$(DIR)/$$x; then \
|
||||||
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
|
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
for x in $(CONF_APPEND) ; do \
|
for x in $(CONF_APPEND); do \
|
||||||
if test -e $(DESTDIR)$(DIR)/$$x; then \
|
if test -e $(DESTDIR)$(DIR)/$$x; then \
|
||||||
cat $$x >> $(DESTDIR)$(DIR)/$$x || exit $$?; \
|
cat $$x >> $(DESTDIR)$(DIR)/$$x || exit $$?; \
|
||||||
else \
|
else \
|
||||||
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
|
$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: all clean install
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
DIR = /etc
|
DIR = /etc
|
||||||
FILES = rc rc.shutdown
|
CONF = rc rc.shutdown
|
||||||
|
|
||||||
TOPDIR = ..
|
TOPDIR = ..
|
||||||
include $(TOPDIR)/default.mk
|
include $(TOPDIR)/default.mk
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
BOOTLEVEL = net.lo0 sysctl syscons
|
BOOTLEVEL = net.lo0 sysctl syscons
|
||||||
DEFAULT =
|
DEFAULT =
|
||||||
|
|
||||||
install:
|
LEVELDIR = $(DESTDIR)/etc/runlevels
|
||||||
install -d -m 0755 $(DESTDIR)/etc/runlevels/boot || exit $$?
|
BOOTDIR = $(LEVELDIR)/boot
|
||||||
for x in $(BOOT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/boot/"$$x" || exit $$? ; done
|
DEFAULTDIR = $(LEVELDIR)/default
|
||||||
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
|
install:
|
||||||
|
if ! test -d "$(BOOTDIR)" ; then \
|
||||||
|
$(INSTALL) -d $(BOOTDIR) || exit $$?; \
|
||||||
|
for x in $(BOOT); do ln -snf ../../init.d/"$$x" $(BOOTDIR)/"$$x" || exit $$? ; done \
|
||||||
|
fi
|
||||||
|
if ! test -d "$(DEFAULTDIR)" ; then \
|
||||||
|
$(INSTALL) -d $(DEFAULTDIR) || exit $$?; \
|
||||||
|
for x in $(DEFAULT); do ln -snf ../../init.d/"$$x" $(DEFAULTDIR)/"$$x" || exit $$? ; done \
|
||||||
|
fi
|
||||||
|
|
||||||
|
all:
|
||||||
|
clean:
|
||||||
|
|
||||||
# vim: set ts=4 :
|
# vim: set ts=4 :
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
BOOT = consolefont keymaps modules net.lo
|
BOOT = consolefont keymaps modules net.lo
|
||||||
DEFAULT = hdparm
|
DEFAULT = hdparm
|
||||||
|
|
||||||
install:
|
LEVELDIR = $(DESTDIR)/etc/runlevels
|
||||||
install -d -m 0755 $(DESTDIR)/etc/runlevels/boot || exit $$?
|
BOOTDIR = $(LEVELDIR)/boot
|
||||||
for x in $(BOOT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/boot/"$$x" || exit $$? ; done
|
DEFAULTDIR = $(LEVELDIR)/default
|
||||||
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
|
install:
|
||||||
|
if ! test -d "$(BOOTDIR)" ; then \
|
||||||
|
$(INSTALL) -d $(BOOTDIR) || exit $$?; \
|
||||||
|
for x in $(BOOT); do ln -snf ../../init.d/"$$x" $(BOOTDIR)/"$$x" || exit $$? ; done \
|
||||||
|
fi
|
||||||
|
if ! test -d "$(DEFAULTDIR)" ; then \
|
||||||
|
$(INSTALL) -d $(DEFAULTDIR) || exit $$?; \
|
||||||
|
for x in $(DEFAULT); do ln -snf ../../init.d/"$$x" $(DEFAULTDIR)/"$$x" || exit $$? ; done \
|
||||||
|
fi
|
||||||
|
|
||||||
|
all:
|
||||||
|
clean:
|
||||||
|
|
||||||
# vim: set ts=4 :
|
# vim: set ts=4 :
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
BOOT = bootmisc checkroot checkfs clock hostname localmount rmnologin urandom
|
BOOT = bootmisc checkroot checkfs clock hostname localmount rmnologin urandom
|
||||||
DEFAULT = local netmount
|
DEFAULT = local netmount
|
||||||
|
|
||||||
install:
|
LEVELDIR = $(DESTDIR)/etc/runlevels
|
||||||
install -d -m 0755 $(DESTDIR)/etc/runlevels/boot || exit $$?
|
BOOTDIR = $(LEVELDIR)/boot
|
||||||
for x in $(BOOT) ; do ln -snf ../../init.d/"$$x" $(DESTDIR)/etc/runlevels/boot/"$$x" || exit $$? ; done
|
DEFAULTDIR = $(LEVELDIR)/default
|
||||||
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
|
install:
|
||||||
|
if ! test -d "$(BOOTDIR)" ; then \
|
||||||
|
$(INSTALL) -d $(BOOTDIR) || exit $$?; \
|
||||||
|
for x in $(BOOT); do ln -snf ../../init.d/"$$x" $(BOOTDIR)/"$$x" || exit $$? ; done \
|
||||||
|
fi
|
||||||
|
if ! test -d "$(DEFAULTDIR)" ; then \
|
||||||
|
$(INSTALL) -d $(DEFAULTDIR) || exit $$?; \
|
||||||
|
for x in $(DEFAULT); do ln -snf ../../init.d/"$$x" $(DEFAULTDIR)/"$$x" || exit $$? ; done \
|
||||||
|
fi
|
||||||
|
|
||||||
|
all:
|
||||||
|
clean:
|
||||||
|
|
||||||
# vim: set ts=4 :
|
# vim: set ts=4 :
|
||||||
|
@ -5,3 +5,12 @@ BIN = gendepends.sh net.sh rc-mount.sh rc-help.sh runscript.sh
|
|||||||
|
|
||||||
TOPDIR = ..
|
TOPDIR = ..
|
||||||
include $(TOPDIR)/default.mk
|
include $(TOPDIR)/default.mk
|
||||||
|
|
||||||
|
install::
|
||||||
|
# Handle lib correctly
|
||||||
|
if test $(LIB) != "lib" ; then \
|
||||||
|
sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$? ; \
|
||||||
|
rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak ; \
|
||||||
|
sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$? ; \
|
||||||
|
rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak ; \
|
||||||
|
fi
|
||||||
|
19
src/Makefile
19
src/Makefile
@ -6,12 +6,6 @@
|
|||||||
# to type make instead of gmake, but also so that other distros can pick
|
# to type make instead of gmake, but also so that other distros can pick
|
||||||
# it up and not rely on GNU Make.
|
# it up and not rely on GNU Make.
|
||||||
|
|
||||||
# NOTE:- FreeBSD and DragonFly have no way of optionally including files
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
CFLAGS += -O2 -pipe
|
CFLAGS += -O2 -pipe
|
||||||
LDFLAGS += -L.
|
LDFLAGS += -L.
|
||||||
@ -22,7 +16,7 @@ check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
|||||||
|
|
||||||
# pmake check for extra cflags
|
# pmake check for extra cflags
|
||||||
WEXTRA != for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \
|
WEXTRA != for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \
|
||||||
if $(CC) -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
if $(CC) -W$$x -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
|
||||||
then echo -n "$$x "; fi \
|
then echo -n "$$x "; fi \
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -101,6 +95,9 @@ include Makefile.$(PAM)
|
|||||||
|
|
||||||
all: .depend $(TARGET)
|
all: .depend $(TARGET)
|
||||||
|
|
||||||
|
version.h:
|
||||||
|
sed -n -e 's/^VERSION =[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1\"/p' ../Makefile > version.h
|
||||||
|
|
||||||
$(LIBEINFOOBJS):
|
$(LIBEINFOOBJS):
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c $<
|
||||||
$(LIBEINFOSO): einfo.map $(LIBEINFOOBJS)
|
$(LIBEINFOSO): einfo.map $(LIBEINFOOBJS)
|
||||||
@ -160,10 +157,10 @@ install:: $(TARGET)
|
|||||||
|
|
||||||
clean-links:
|
clean-links:
|
||||||
rm -f $(ALL_LINKS)
|
rm -f $(ALL_LINKS)
|
||||||
clean::
|
clean:: clean-links
|
||||||
echo > .depend
|
echo > .depend
|
||||||
touch -r Makefile .depend
|
touch -r Makefile .depend
|
||||||
rm -f $(TARGET)
|
rm -f $(TARGET) version.h
|
||||||
rm -f *.o *~ *.core *.so *.a
|
rm -f *.o *~ *.core *.so *.a
|
||||||
|
|
||||||
check:
|
check:
|
||||||
@ -171,7 +168,5 @@ check:
|
|||||||
|
|
||||||
include .depend
|
include .depend
|
||||||
_DEPS != ls *.c *.h
|
_DEPS != ls *.c *.h
|
||||||
.depend: $(_DEPS)$(wildcard *.c *.h)
|
.depend: version.h $(_DEPS)$(wildcard *.c *.h)
|
||||||
$(CC) $(CPPFLAGS) -MM *.c > .depend
|
$(CC) $(CPPFLAGS) -MM *.c > .depend
|
||||||
|
|
||||||
.PHONY: all clean clean-links install links
|
|
||||||
|
Loading…
Reference in New Issue
Block a user