aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 5afce008917f4165b064e21eace19c89c0c4f8cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# 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/
	ln -srf $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts/{ifup-ippp,ifup-isdn}
	ln -srf $(DESTDIR)$(sysconfdir)/sysconfig/network-scripts/{ifdown-ippp,ifdown-isdn}

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

# 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
	touch $(DESTDIR)$(sysconfdir)/rc.d/rc.local
	chmod 0755 $(DESTDIR)$(sysconfdir)/rc.d/rc.local

clean:
	$(MAKE) clean -C src
	$(MAKE) clean -C po
	@find . -name "*~" -exec rm -v -f {} \;

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"