diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 216 |
1 files changed, 112 insertions, 104 deletions
@@ -1,120 +1,128 @@ -ROOT= -SUPERUSER=root -SUPERGROUP=root - -VERSION := $(shell awk '/Version:/ { print $$2 }' initscripts.spec) -TAG=$(VERSION) - -mandir=/usr/share/man - -all: - make -C src - make -C po - -install: - mkdir -p $(ROOT)/etc/profile.d $(ROOT)/usr/sbin - mkdir -p $(ROOT)$(mandir)/man{5,8} - mkdir -p $(ROOT)/etc/rwtab.d $(ROOT)/etc/statetab.d - mkdir -p $(ROOT)/var/lib/stateless/writable - mkdir -p $(ROOT)/var/lib/stateless/state - - install -m644 adjtime $(ROOT)/etc - install -m644 rwtab statetab networks $(ROOT)/etc - install -m755 service $(ROOT)/usr/sbin - install -m644 lang.csh lang.sh $(ROOT)/etc/profile.d - install -m755 sys-unconfig $(ROOT)/usr/sbin - install -m644 service.8 sys-unconfig.8 $(ROOT)$(mandir)/man8 - - install -m755 -d $(ROOT)/etc/rc.d $(ROOT)/etc/sysconfig - cp -af rc.d/init.d $(ROOT)/etc/rc.d/ - install -m644 sysconfig/netconsole sysconfig/readonly-root $(ROOT)/etc/sysconfig/ - cp -af sysconfig/network-scripts $(ROOT)/etc/sysconfig/ - cp -af NetworkManager $(ROOT)/etc - # (cg) Are the two lines below needed these days??? - mkdir -p $(ROOT)/etc/sysconfig/console/consolefonts - mkdir -p $(ROOT)/etc/sysconfig/console/consoletrans - mkdir -p $(ROOT)/usr/lib/systemd/ - cp -af systemd/* $(ROOT)/usr/lib/systemd/ - chmod 755 $(ROOT)/usr/lib/systemd/mandriva-* - mkdir -p $(ROOT)/usr/lib - cp -af udev $(ROOT)/usr/lib - chmod 755 $(ROOT)/etc/rc.d/* $(ROOT)/etc/rc.d/init.d/* - chmod 644 $(ROOT)/etc/rc.d/init.d/functions - chmod 755 $(ROOT)/etc/sysconfig/network-scripts/ifup-* - chmod 755 $(ROOT)/etc/sysconfig/network-scripts/ifdown-* - chmod 755 $(ROOT)/etc/sysconfig/network-scripts/init* - chmod 755 $(ROOT)/etc/NetworkManager/dispatcher.d/00-netreport - mkdir -p $(ROOT)/etc/sysconfig/modules - mkdir -p $(ROOT)/etc/sysconfig/console - - mv $(ROOT)/etc/sysconfig/network-scripts/ifup $(ROOT)/usr/sbin - mv $(ROOT)/etc/sysconfig/network-scripts/ifdown $(ROOT)/usr/sbin - (cd $(ROOT)/etc/sysconfig/network-scripts; \ - ln -sf ../../../usr/sbin/ifup . ; \ - ln -sf ../../../usr/sbin/ifdown . ) - make install ROOT=$(ROOT) mandir=$(mandir) -C src - make install PREFIX=$(ROOT) -C po - - mkdir -p $(ROOT)/run/netreport $(ROOT)/var/log - chown $(SUPERUSER):$(SUPERGROUP) $(ROOT)/run/netreport - chmod u=rwx,g=rwx,o=rx $(ROOT)/run/netreport - - for i in 0 1 2 3 4 5 6 ; do \ - dir=$(ROOT)/etc/rc.d/rc$$i.d; \ - mkdir $$dir; \ - chmod u=rwx,g=rx,o=rx $$dir; \ - done +# Basic Makefile for compiling & installing the files. +# +# Supports standard GNU Makefile variables for specifying the paths: +# * prefix +# * exec_prefix +# * bindir +# * sbindir +# * libdir +# * datarootdir +# * datadir +# * mandir +# * sysconfdir +# * localstatedir +# * DESTDIR +# + +SHELL = /bin/bash + +# Normally /usr/local is used. However, it does not make sense for us to use it +# here, as it just complicates things even further. +prefix = /usr +exec_prefix = $(prefix) +bindir = $(prefix)/bin +sbindir = $(prefix)/sbin +libdir = $(prefix)/lib +libexecdir = $(exec_prefix)/libexec +datarootdir = $(prefix)/share +datadir = $(datarootdir) +mandir = $(datadir)/man +sysconfdir = /etc +localstatedir = /var +sharedstatedir = $(localstatedir)/lib + +VERSION := $(shell gawk '/Version:/ { print $$2 }' initscripts.spec) +NEXT_VERSION := $(shell gawk '/Version:/ { print $$2 + 0.01}' initscripts.spec) + + +all: make-binaries make-translations + + +make-binaries: + $(MAKE) -C src + +make-translations: + $(MAKE) -C po PYTHON=$(PYTHON) + + +# NOTE: We are no longer installing into /usr/sbin directory, because this is +# just a symlink to /usr/bin, thanks to UsrMove change. Instead, we just +# use virtual provides for /usr/sbin/<utility> in specfile (for backward +# compatibility). +install: install-binaries install-translations install-etc install-usr install-network-scripts install-man install-post + + +install-binaries: + $(MAKE) install -C src DESTDIR=$(DESTDIR) prefix=$(prefix) bindir=$(bindir) libdir=$(libdir) + +install-translations: + $(MAKE) install -C po DESTDIR=$(DESTDIR) prefix=$(prefix) bindir=$(bindir) libdir=$(libdir) \ + datarootdir=$(datarootdir) datadir=$(datadir) sysconfdir=$(sysconfdir) + + +# NOTE: We are removing auxiliary symlink at the beginning. +install-etc: + rm -f etc/sysconfig/network-scripts + install -m 0755 -d $(DESTDIR)$(sysconfdir) + cp -a etc/* $(DESTDIR)$(sysconfdir)/ + +install-usr: + install -m 0755 -d $(DESTDIR)$(prefix) + cp -a usr/* $(DESTDIR)$(prefix)/ + +install-network-scripts: install-usr install-etc + install -m 0755 -d $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts + cp -a network-scripts/* $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts/ + +install-man: install-usr + install -m 0755 -d $(DESTDIR)$(mandir)/man1 + install -m 0755 -d $(DESTDIR)$(mandir)/man8 + install -m 0644 man/*.1 $(DESTDIR)$(mandir)/man1 + install -m 0644 man/*.8 $(DESTDIR)$(mandir)/man8 # install translated man pages for j in 1 3 8 ; do \ - for i in man/??* ; do \ - install -d $(ROOT)$(mandir)/`basename $$i`/man$$j ; \ - install -m 644 $$i/*.$$j $(ROOT)$(mandir)/`basename $$i`/man$$j ; \ - done ; \ - done - -# Can't store symlinks in a CVS archive - mkdir -p $(ROOT)/usr/lib/tmpfiles.d - install -m 644 initscripts.tmpfiles.d $(ROOT)/usr/lib/tmpfiles.d/initscripts.conf - install -m 644 mandriva.tmpfiles.d $(ROOT)/usr/lib/tmpfiles.d/mandriva.conf - -# These are LSB compatibility symlinks. At some point in the future -# the actual files will be here instead of symlinks - for i in 0 1 2 3 4 5 6 S ; do \ - ln -s rc.d/rc$$i.d $(ROOT)/etc/rc$$i.d; \ + for i in man/??* ; do \ + install -m 644 $$i/*.$$j $(DESTDIR)$(mandir)/`basename $$i`/man$$j ; \ + done ; \ done - mkdir -p -m 755 $(ROOT)/usr/libexec/initscripts/legacy-actions - -syntax-check: - for afile in `find . -type f -perm +111|grep -v \.csh | grep -v .git | grep -v po/ | grep -v 'gprintify.py' ` ; do \ - if ! file $$afile | grep -s ELF >/dev/null && ! file $$afile | grep -s perl >/dev/null; then \ - bash -n $$afile || { echo $$afile ; exit 1 ; } ; \ - fi ;\ +# Initscripts still ship some empty directories necessary for system to function +# correctly... +install-post: install-etc + install -m 0755 -d $(DESTDIR)$(sysconfdir)/sysconfig/console + install -m 0755 -d $(DESTDIR)$(sysconfdir)/sysconfig/modules + install -m 0755 -d $(DESTDIR)$(sharedstatedir)/stateless/state + install -m 0755 -d $(DESTDIR)$(sharedstatedir)/stateless/writable + install -m 0755 -d $(DESTDIR)$(libexecdir)/initscripts/legacy-actions + for idx in {0..6}; do \ + dir=$(DESTDIR)$(sysconfdir)/rc.d/rc$$idx.d; \ + install -m 0755 -d $$dir; \ + ln -srf $(DESTDIR)$(sysconfdir)/rc.d/rc$$idx.d $(DESTDIR)$(sysconfdir)/; \ done - make -C mandriva check - -check: syntax-check - make check -C src - make clean -C src - -changelog: - make -C mandriva changelog + ln -srf $(DESTDIR)$(sysconfdir)/rc.d/init.d $(DESTDIR)$(sysconfdir)/init.d clean: - make clean -C src - make clean -C po - @rm -fv *~ changenew ChangeLog.old *gz + $(MAKE) clean -C src + $(MAKE) clean -C po @find . -name "*~" -exec rm -v -f {} \; tag: - @git tag -a -f -m "Tag as $(TAG)" $(TAG) - @echo "Tagged as $(TAG)" - -archive: clean changelog + @git tag -a -f -m "$(VERSION) release" $(VERSION) + @echo "Tagged as $(VERSION)" + +release-commit: + @git log --decorate=no --format="- %s" $(VERSION)..HEAD > .changelog.tmp + @rpmdev-bumpspec -n $(NEXT_VERSION) -f .changelog.tmp initscripts.spec + @rm -f .changelog.tmp + @git add initscripts.spec + @git commit --message="$(NEXT_VERSION)" + @echo -e "\n New release commit ($(NEXT_VERSION)) created:\n" + @git show + +archive: clean @git archive --format=tar --prefix=initscripts-$(VERSION)/ HEAD > initscripts-$(VERSION).tar @mkdir -p initscripts-$(VERSION)/ - @cp ChangeLog initscripts-$(VERSION)/ @tar --append -f initscripts-$(VERSION).tar initscripts-$(VERSION) @gzip -f initscripts-$(VERSION).tar @rm -rf initscripts-$(VERSION) |