# 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) Mageia_DIR := mageia Mageia_FILES := $(shell cd $(Mageia_DIR); find etc network-scripts usr -type f \! -name .keep) Mageia_SUBDIRS := $(shell cd $(Mageia_DIR); find -type d -links 2) PO := po-mageia Mageia_MANDIR := man-mageia 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/ in specfile (for backward # compatibility). install: install-mageia install-binaries install-translations install-etc install-usr install-network-scripts install-man install-post install-mageia: @echo "Modifying structure for Mageia" # Ensure the directories used by Mageia exist in the main directory @for i in $(Mageia_SUBDIRS); do mkdir -p $$i; echo "$$i";done # Now copy over the various files to the main directory. This allows # the standard logic of this Makefile to work @for i in $(Mageia_FILES);do cp -a $(Mageia_DIR)/$$i $$i;done 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 8 ; do \ for i in $(Mageia_MANDIR)/??* ; do \ install -d $(DESTDIR)$(mandir)/`basename $$i`/man$$j ; \ install -m 644 $$i/*.$$j $(DESTDIR)$(mandir)/`basename $$i`/man$$j ; \ done ; \ done # 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 ln -srf $(DESTDIR)$(sysconfdir)/rc.d/init.d $(DESTDIR)$(sysconfdir)/init.d clean: clean-mageia $(MAKE) clean -C src $(MAKE) clean -C $(PO) @find . -name "*~" -exec rm -v -f {} \; clean-mageia: # Remove the files we've added @for i in $(Mageia_FILES);do rm -f $$i;done # Try to remove any empty directories caused by the files we've removed @for i in $(Mageia_SUBDIRS);do [ -d "$$1" ] && [ ! -h "$$1" ] && rmdir "$$1" 2> /dev/null || :;done tag: @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)/ @tar --append -f initscripts-$(VERSION).tar initscripts-$(VERSION) @gzip -f initscripts-$(VERSION).tar @rm -rf initscripts-$(VERSION) @echo "The archive is at initscripts-$(VERSION).tar.gz" mageiadist: clean # Make a tarball for all the bits which are unlikely to change @git archive --format=tar --prefix=initscripts-$(VERSION)/ $(git rev-parse HEAD) ':po-mageia' ':man-mageia' > initscripts-$(VERSION)-mageia.tar @mkdir -p initscripts-$(VERSION)/ @tar --append -f initscripts-$(VERSION)-mageia.tar initscripts-$(VERSION) @xz -f -5 initscripts-$(VERSION)-mageia.tar @rm -rf initscripts-$(VERSION) @echo "The Mageia archive is at initscripts-$(VERSION)-mageia.tar.xz" # Make a tarball for all the bits which could change more often @git diff 10.04...distro/mga ':!po-mageia' ':!man-mageia' > initscripts-$(VERSION)-mageia.patch @echo "The Mageia patch is at initscripts-$(VERSION)-mageia.patch"