-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
56 lines (46 loc) · 1.87 KB
/
Makefile
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
CC = gcc
CFLAGS = -c -g -O2 -Wall -Wno-pointer-sign
LDFLAGS = -luuid
GIT2LOG := $(shell if [ -x ./git2log ] ; then echo ./git2log --update ; else echo true ; fi)
GITDEPS := $(shell [ -d .git ] && echo .git/HEAD .git/refs/heads .git/refs/tags)
VERSION := $(shell $(GIT2LOG) --version VERSION ; cat VERSION)
BRANCH := $(shell [ -d .git ] && git branch | perl -ne 'print $$_ if s/^\*\s*//')
PREFIX := mksusecd-$(VERSION)
BINDIR = /usr/bin
LIBDIR = /usr/lib
all: changelog isohybrid
isohdpfx.o: isohdpfx.c
$(CC) $(CFLAGS) -c $<
isohybrid.o: isohybrid.c isohybrid.h
$(CC) $(CFLAGS) $<
isohybrid: isohybrid.o isohdpfx.o
$(CC) $^ $(LDFLAGS) -o $@
archive: changelog
@if [ ! -d .git ] ; then echo no git repo ; false ; fi
mkdir -p package
git archive --prefix=$(PREFIX)/ $(BRANCH) > package/$(PREFIX).tar
tar -r -f package/$(PREFIX).tar --mode=0664 --owner=root --group=root --mtime="`git show -s --format=%ci`" --transform='s:^:$(PREFIX)/:' VERSION changelog
xz -f package/$(PREFIX).tar
changelog: $(GITDEPS)
$(GIT2LOG) --changelog changelog
install: isohybrid doc
@cp mksusecd mksusecd.tmp
@perl -pi -e 's/0\.0/$(VERSION)/ if /VERSION = /' mksusecd.tmp
@perl -pi -e 's#"(.*)"#"$(LIBDIR)"# if /LIBEXECDIR = /' mksusecd.tmp
@cp isozipl isozipl.tmp
@perl -pi -e 's/0\.0/$(VERSION)/ if /VERSION = /' isozipl.tmp
install -m 755 -D mksusecd.tmp $(DESTDIR)$(BINDIR)/mksusecd
install -m 755 -D isozipl.tmp $(DESTDIR)$(BINDIR)/isozipl
install -m 755 -D isohybrid $(DESTDIR)$(LIBDIR)/mksusecd/isohybrid
@rm -f mksusecd.tmp isozipl.tmp
doc:
@if [ -x /usr/bin/asciidoctor ] ; then \
asciidoctor -b manpage -a version=$(VERSION) mksusecd_man.adoc ;\
else \
a2x -f manpage -a version=$(VERSION) mksusecd_man.adoc ;\
fi
# a2x -f docbook -a version=$(VERSION) mksusecd_man.adoc
# dblatex mksusecd_man.xml
clean:
@rm -f *.o isohybrid *~ */*~ mksusecd{.1,_man.xml,_man.pdf}
@rm -rf package