summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 73b3433f34bf59b22e4d027c63f0f40d3efca342 (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
PL=rebootin
SH_FILES=detectloader installkernel installkernel.sysconfig kernel_remove_initrd
SH=$(SH_FILES) kheader
MAN=rebootin.8 detectloader.8
FROMPERLFILES=kheader
ARCH=$(shell uname -m)

UTILS = bootloader-utils.spec Makefile
FILES = $(PL) $(SH_FILES) $(MAN) $(UTILS) $(FROMPERLFILES:%=%.pl)

PACKAGE=bootloader-utils
VERSION=1.16
TAG = $(VERSION)

SVN_URL := $(shell svn info | sed -n '/^URL[^:]*:  *\(.*\)/s//\1/p')
SVNROOT := $(shell dirname $(SVN_URL))
SVNCOPY = $(SVN_URL)

all: $(FROMPERLFILES) check

check:
	@for i in $(SH);do /bin/bash -n $$i || exit 1;echo $$i syntax OK;done
	@for i in $(PL);do perl -c $$i ||exit 1;done

install: check
	install -d $(ROOT)/usr/share/man/man8/
	install -d $(ROOT)/{,usr}/sbin
	install -d $(ROOT)/etc/sysconfig
	install -d $(ROOT)/etc/rc.d/init.d
	install -m644 $(MAN) $(ROOT)/usr/share/man/man8/
	install -m755 installkernel $(ROOT)/sbin/
	install -m755 kernel_remove_initrd $(ROOT)/sbin/
	install -m644 installkernel.sysconfig $(ROOT)/etc/sysconfig/installkernel
	install -m755 rebootin detectloader $(ROOT)/usr/sbin/
	install -m755 kheader $(ROOT)/etc/rc.d/init.d/kheader

$(FROMPERLFILES) : %: %.pl
	rm -f $@
	perl $< > $@
	chmod a-w $@

clean:
	rm -f *~ $(FROMPERLFILES) $(PACKAGE)-*.tar.bz2

# rules to build a test dist

localdist: cleandist dir localcopy tar

cleandist:
	rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.bz2

dir:
	mkdir $(PACKAGE)-$(VERSION)

localcopy:
	tar c $(FILES) | tar x -C $(PACKAGE)-$(VERSION)


# rules to build a distributable dist

dist: cleandist 
	@make dist-svn

dist-svn:
	svn export $(SVNROOT)/releases/$(TAG) $(PACKAGE)-$(VERSION)
	tar cvfa $(PACKAGE)-$(VERSION).tar.xz $(PACKAGE)-$(VERSION)
	rm -rf $(PACKAGE)-$(VERSION)

svntag:
	-svn mkdir $(SVN_BASE)/releases/$(TAG) -m "created directory $(TAG)"
	svn copy $(SVNCOPY) $(SVNROOT)/releases/$(TAG) -m "Tagged as $(TAG)"

localchangelog:
#svn2cl is available in our contrib.
	svn cat `dirname $(SVNROOT)`/common/username.xml > $$TMPDIR/username.xml; \
	svn2cl --authors $$TMPDIR/username.xml --accum; \
	rm -f ChangeLog.bak $$TMPDIR/username.xml

changelog: localchangelog
	svn commit -m "Generated by svn2cl the `date '+%d_%b'`" ChangeLog

# Makefile ends here