aboutsummaryrefslogtreecommitdiffstats
path: root/japanese/nkf/files/patch-Makefile
blob: ba6e271f1dffdccc4807971ae8e31fdbdadd9297 (plain) (blame)
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
--- Makefile.orig   2013-11-22 14:17:36.000000000 +0900
+++ Makefile    2013-12-26 10:08:41.000000000 +0900
@@ -1,21 +1,31 @@
-CC = cc
-CFLAGS = -g -O2 -Wall -pedantic
+CC? = cc
+CFLAGS? = -g -O2 -Wall -pedantic
 # CFLAGS = -O3
 SHAR = shar 
 # SHAR = shar -T
 PERL = perl
 RM = rm -rf
 VERSION = 2.1.3
-MKDIR = mkdir
-prefix = /usr/local
+MKDIR? = mkdir
+prefix = $(DESTDIR)$(PREFIX)
+manprefix = $(DESTDIR)$(MANPREFIX)
 PYTHON2 = python
 PYTHON3 = python
+BSD_INSTALL_PROGRAM?= ${INSTALL} -s -o root -g wheel -m 555
+BSD_INSTALL_MAN?= ${INSTALL}    -o root -g wheel -m 444
 
 .PHONY: clean install test tar shar
 
+all: nkf man
+
 nkf : nkf.o utf8tbl.o
    $(CC) $(CFLAGS) -o nkf nkf.o utf8tbl.o
 
+man: nkf.1j nkf.1j.euc
+
+nkf.1j.euc: nkf nkf.1j
+   ./nkf -e nkf.1j > nkf.1j.euc
+
 nkf.o : nkf.c nkf.h utf8tbl.h config.h
    $(CC) $(CFLAGS) -c nkf.c
 
@@ -45,13 +55,11 @@
 
 install:
    -$(MKDIR) $(prefix)/bin
-   -$(MKDIR) $(prefix)/man
-   -$(MKDIR) $(prefix)/man/man1
-   -$(MKDIR) $(prefix)/man/ja
-   -$(MKDIR) $(prefix)/man/ja/man1
-   cp -f nkf $(prefix)/bin/
-   cp -f nkf.1 $(prefix)/man/man1/
-   cp -f nkf.1j $(prefix)/man/ja/man1/nkf.1
+   -$(MKDIR) $(manprefix)/man/man1
+   -$(MKDIR) $(manprefix)/man/ja/man1
+   ${BSD_INSTALL_PROGRAM} nkf $(prefix)/bin/
+   ${BSD_INSTALL_MAN} nkf.1 $(manprefix)/man/man1/
+   ${BSD_INSTALL_MAN} nkf.1j.euc $(manprefix)/man/ja/man1/nkf.1
 
 shar:
    -mkdir nkf-$(VERSION)