Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

makefile: spring cleaning

- use MANPAGES instead of DIST_EXTRA (it's only manpages anyways)
- uniformly use $(var) instead of ${var}
- consolidate manpage generate rules
- prefer cp over install when symlinks might be involved
  • Loading branch information...
commit 497f2b4458fcd5fff9b0a3bdb58cfcf16845101d 1 parent 321fa7f
Dave Reisner authored

Showing 1 changed file with 32 additions and 40 deletions. Show diff stats Hide diff stats

  1. +32 40 Makefile
72 Makefile
@@ -10,73 +10,65 @@ DIRS = \
10 10 /usr/lib/initcpio/install \
11 11 /usr/lib/initcpio/udev \
12 12 /usr/share/man/man8 \
  13 + /usr/share/man/man5 \
13 14 /usr/share/man/man1
14 15
15   -DIST_EXTRA = \
  16 +all: doc
  17 +
  18 +MANPAGES = \
16 19 mkinitcpio.8 \
17 20 lsinitcpio.1
18 21
19   -all: doc
20   -
21 22 install: all
22   - mkdir -p ${DESTDIR}
23   - $(foreach dir,${DIRS},install -dm755 ${DESTDIR}${dir};)
  23 + mkdir -p $(DESTDIR)
  24 + $(foreach dir,$(DIRS),install -dm755 $(DESTDIR)$(dir);)
24 25
25 26 sed -e 's|^_f_config=.*|_f_config=/etc/mkinitcpio.conf|' \
26 27 -e 's|^_f_functions=.*|_f_functions=/usr/lib/initcpio/functions|' \
27 28 -e 's|^_d_hooks=.*|_d_hooks=({/usr,}/lib/initcpio/hooks)|' \
28 29 -e 's|^_d_install=.*|_d_install=({/usr,}/lib/initcpio/install)|' \
29 30 -e 's|^_d_presets=.*|_d_presets=/etc/mkinitcpio.d|' \
30   - -e 's|%VERSION%|${VERSION}|g' \
31   - < mkinitcpio > ${DESTDIR}/usr/bin/mkinitcpio
  31 + -e 's|%VERSION%|$(VERSION)|g' \
  32 + < mkinitcpio > $(DESTDIR)/usr/bin/mkinitcpio
32 33
33 34 sed -e 's|\(^_f_functions\)=.*|\1=/usr/lib/initcpio/functions|' \
34   - -e 's|%VERSION%|${VERSION}|g' \
35   - < lsinitcpio > ${DESTDIR}/usr/bin/lsinitcpio
  35 + -e 's|%VERSION%|$(VERSION)|g' \
  36 + < lsinitcpio > $(DESTDIR)/usr/bin/lsinitcpio
36 37
37   - chmod 755 ${DESTDIR}/usr/bin/lsinitcpio ${DESTDIR}/usr/bin/mkinitcpio
  38 + chmod 755 $(DESTDIR)/usr/bin/lsinitcpio $(DESTDIR)/usr/bin/mkinitcpio
38 39
39   - install -m644 mkinitcpio.conf ${DESTDIR}/etc/mkinitcpio.conf
40   - install -m755 -t ${DESTDIR}/usr/lib/initcpio init shutdown
41   - install -m644 -t ${DESTDIR}/usr/lib/initcpio init_functions functions
42   - install -m644 01-memdisk.rules ${DESTDIR}/usr/lib/initcpio/udev/01-memdisk.rules
  40 + install -m644 mkinitcpio.conf $(DESTDIR)/etc/mkinitcpio.conf
  41 + install -m755 -t $(DESTDIR)/usr/lib/initcpio init shutdown
  42 + install -m644 -t $(DESTDIR)/usr/lib/initcpio init_functions functions
  43 + install -m644 01-memdisk.rules $(DESTDIR)/usr/lib/initcpio/udev/01-memdisk.rules
43 44
44   - install -m644 -t ${DESTDIR}/usr/lib/initcpio/hooks hooks/*
45   - install -m644 -t ${DESTDIR}/usr/lib/initcpio/install install/*
46   - install -m644 -t ${DESTDIR}/etc/mkinitcpio.d mkinitcpio.d/*
  45 + cp -at $(DESTDIR)/usr/lib/initcpio/hooks hooks/*
  46 + cp -at $(DESTDIR)/usr/lib/initcpio/install install/*
  47 + cp -at $(DESTDIR)/etc/mkinitcpio.d mkinitcpio.d/*
47 48
48   - install -m644 mkinitcpio.8 ${DESTDIR}/usr/share/man/man8/mkinitcpio.8
49   - install -m644 lsinitcpio.1 ${DESTDIR}/usr/share/man/man1/lsinitcpio.1
50   - install -m644 bash-completion ${DESTDIR}/usr/share/bash-completion/completions/mkinitcpio
51   - ln -s mkinitcpio ${DESTDIR}/usr/share/bash-completion/completions/lsinitcpio
  49 + install -m644 mkinitcpio.8 $(DESTDIR)/usr/share/man/man8/mkinitcpio.8
  50 + install -m644 lsinitcpio.1 $(DESTDIR)/usr/share/man/man1/lsinitcpio.1
  51 + install -m644 bash-completion $(DESTDIR)/usr/share/bash-completion/completions/mkinitcpio
  52 + ln -s mkinitcpio $(DESTDIR)/usr/share/bash-completion/completions/lsinitcpio
52 53
53   -doc: mkinitcpio.8 lsinitcpio.1
54   -mkinitcpio.8: mkinitcpio.8.txt Makefile
  54 +doc: $(MANPAGES)
  55 +%: %.txt Makefile
55 56 a2x -d manpage \
56 57 -f manpage \
57   - -a mansource=mkinitcpio \
58   - -a manversion=${VERSION} \
59   - -a manmanual=mkinitcpio mkinitcpio.8.txt
60   -
61   -lsinitcpio.1: lsinitcpio.1.txt Makefile
62   - a2x -d manpage \
63   - -f manpage \
64   - -a mansource=lsinitcpio \
65   - -a manversion=${VERSION} \
66   - -a manmanual=lsinitcpio lsinitcpio.1.txt
  58 + -a manversion=$(VERSION) \
  59 + -a manmanual="mkinitcpio manual" $<
67 60
68 61 clean:
69   - ${RM} -r build mkinitcpio-${VERSION}
70   - ${RM} mkinitcpio-${VERSION}.tar.gz mkinitcpio.8 lsinitcpio.1
  62 + $(RM) -r build mkinitcpio-$(VERSION)
  63 + $(RM) mkinitcpio-${VERSION}.tar.gz $(MANPAGES)
71 64
72 65 dist: doc
73   - echo ${VERSION} > VERSION
  66 + echo $(VERSION) > VERSION
74 67 git ls-files -z | xargs -0 \
75   - bsdtar -czf mkinitcpio-${VERSION}.tar.gz -s ,^,mkinitcpio-${VERSION}/, VERSION ${DIST_EXTRA}
76   - ${RM} VERSION
77   -
  68 + bsdtar -czf mkinitcpio-$(VERSION).tar.gz -s ,^,mkinitcpio-$(VERSION)/, VERSION $(MANPAGES)
  69 + $(RM) VERSION
78 70
79 71 version:
80   - @echo ${VERSION}
  72 + @echo $(VERSION)
81 73
82 74 .PHONY: clean dist install tarball version

0 comments on commit 497f2b4

Please sign in to comment.
Something went wrong with that request. Please try again.