瀏覽代碼

generate a man page for light on make install

Simon Feiden 8 年之前
父節點
當前提交
2fcbd321f2
共有 1 個檔案被更改,包括 9 行新增2 行删除
  1. 9
    2
      Makefile

+ 9
- 2
Makefile 查看文件

@@ -1,24 +1,31 @@
1 1
 PREFIX=$(DESTDIR)/usr
2 2
 BINDIR=$(PREFIX)/bin
3
+MANDIR=/usr/share/man/man1
3 4
 
4 5
 CC=gcc
5 6
 CFLAGS=-std=c89 -O2 -pedantic -Wall -I"./include"
7
+MANFLAGS=-h -h -v -V
6 8
 
7 9
 all:
8 10
 	$(CC) $(CFLAGS) -g -o light src/helpers.c src/light.c src/main.c
9 11
 exp:
10 12
 	$(CC) $(CFLAGS) -E  src/helpers.c src/light.c
13
+man:
14
+	help2man $(MANFLAGS) ./light | gzip - > light.1.gz
11 15
 
12
-install: all
16
+install: all man
13 17
 	mkdir -p $(BINDIR)
14 18
 	cp -f ./light $(BINDIR)/light
15 19
 	chown root $(BINDIR)/light
16 20
 	chmod 4755 $(BINDIR)/light
21
+	mkdir -p $(MANDIR)
22
+	mv light.1.gz $(MANDIR)
17 23
 
18 24
 uninstall:
19 25
 	rm $(BINDIR)/light
20 26
 	rm -rf /etc/light
27
+	rm $(MANDIR)/light.1.gz
21 28
 
22 29
 clean:
23
-	rm -vfr *~ light
30
+	rm -vfr *~ light light.1.gz
24 31