1 |
frodo |
259 |
.SUFFIXES: |
2 |
|
|
|
3 |
|
|
DESTDIR= |
4 |
|
|
prefix=/usr/local |
5 |
|
|
bindir=$(prefix)/bin |
6 |
|
|
mandir=$(prefix)/man |
7 |
|
|
man1dir=$(mandir)/man1 |
8 |
|
|
sharedir=$(prefix)/share |
9 |
frodo |
324 |
getoptdir=$(sharedir)/getopt |
10 |
frodo |
259 |
localedir=$(sharedir)/locale |
11 |
|
|
|
12 |
|
|
# Define this to 0 to use the getopt(3) routines in this package. |
13 |
|
|
LIBCGETOPT=1 |
14 |
|
|
|
15 |
|
|
# Define this to 1 if you do not have the gettext routines |
16 |
|
|
WITHOUT_GETTEXT=0 |
17 |
|
|
|
18 |
frodo |
265 |
# For creating the archive |
19 |
|
|
PACKAGE=getopt |
20 |
frodo |
377 |
VERSION=1.1.6 |
21 |
frodo |
265 |
BASENAME=$(PACKAGE)-$(VERSION) |
22 |
|
|
UNLIKELYNAME=a8vwjfd92 |
23 |
frodo |
259 |
|
24 |
|
|
SHELL=/bin/sh |
25 |
|
|
|
26 |
|
|
CC=gcc |
27 |
|
|
LD=ld |
28 |
|
|
RM=rm -f |
29 |
|
|
INSTALL=install |
30 |
|
|
MSGFMT=msgfmt |
31 |
|
|
|
32 |
frodo |
373 |
LANGUAGES = ca cs da de es et eu fi fr gl hr hu id it ja nl pl pt_BR ru sl sv tr uk vi zh_CN zh_TW |
33 |
frodo |
259 |
MOFILES:=$(patsubst %,po/%.mo,$(LANGUAGES)) |
34 |
|
|
|
35 |
frodo |
325 |
CPPFLAGS=-DLIBCGETOPT=$(LIBCGETOPT) -DWITHOUT_GETTEXT=$(WITHOUT_GETTEXT) -DLOCALEDIR=\"$(localedir)\" -DNOT_UTIL_LINUX -Dprogram_invocation_short_name=\"$(PACKAGE)\" -Dprogram_version=\"$(VERSION)\" |
36 |
frodo |
259 |
ifeq ($(LIBCGETOPT),0) |
37 |
|
|
CPPFLAGS+=-I./gnu |
38 |
|
|
endif |
39 |
|
|
WARNINGS=-Wall \ |
40 |
|
|
-W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual \ |
41 |
|
|
-Wcast-align -Wmissing-declarations \ |
42 |
|
|
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ |
43 |
|
|
-Wnested-externs -Winline |
44 |
|
|
OPTIMIZE=-O3 -fno-strength-reduce |
45 |
|
|
CFLAGS=$(WARNINGS) $(OPTIMIZE) |
46 |
|
|
LDFLAGS= |
47 |
|
|
|
48 |
|
|
sources=getopt.c |
49 |
|
|
ifeq ($(LIBCGETOPT),0) |
50 |
|
|
sources+=gnu/getopt.c gnu/getopt1.c |
51 |
|
|
endif |
52 |
|
|
|
53 |
|
|
objects=$(sources:.c=.o) |
54 |
|
|
|
55 |
|
|
binaries=getopt |
56 |
|
|
|
57 |
|
|
.PHONY: all clean realclean |
58 |
|
|
all: $(binaries) all_po |
59 |
|
|
|
60 |
|
|
clean: clean_po |
61 |
|
|
-$(RM) $(objects) $(binaries) |
62 |
|
|
|
63 |
|
|
getopt: $(objects) |
64 |
|
|
$(CC) $(LDFLAGS) -o $@ $(objects) |
65 |
|
|
|
66 |
|
|
install: getopt install_po |
67 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) |
68 |
|
|
$(INSTALL) -m 755 getopt $(DESTDIR)$(bindir) |
69 |
|
|
$(INSTALL) -m 644 getopt.1 $(DESTDIR)$(man1dir) |
70 |
|
|
|
71 |
|
|
install_doc: |
72 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(getoptdir) |
73 |
|
|
$(INSTALL) -m 755 getopt-parse.bash getopt-parse.tcsh \ |
74 |
|
|
getopt-test.bash getopt-test.tcsh \ |
75 |
|
|
$(DESTDIR)$(getoptdir) |
76 |
|
|
|
77 |
frodo |
325 |
ifeq ($(WITHOUT_GETTEXT),0) |
78 |
frodo |
259 |
all_po: $(MOFILES) |
79 |
|
|
install_po: all_po |
80 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(localedir) |
81 |
|
|
for lang in $(LANGUAGES) ; do \ |
82 |
|
|
dir=$(localedir)/$$lang/LC_MESSAGES; \ |
83 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$$dir ;\ |
84 |
|
|
$(INSTALL) -m 644 po/$$lang.mo $(DESTDIR)$$dir/getopt.mo ;\ |
85 |
|
|
done |
86 |
|
|
clean_po: |
87 |
|
|
$(RM) $(MOFILES) |
88 |
|
|
else |
89 |
|
|
all_po: |
90 |
|
|
install_po: |
91 |
|
|
clean_po: |
92 |
|
|
endif |
93 |
|
|
|
94 |
|
|
%.o: %.c |
95 |
|
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c -o $*.o |
96 |
|
|
|
97 |
|
|
%.mo: %.po |
98 |
|
|
$(MSGFMT) -o $@ $< |
99 |
frodo |
265 |
|
100 |
|
|
# You need GNU tar for this to work! |
101 |
|
|
.PHONY: package |
102 |
|
|
package: clean |
103 |
|
|
$(RM) -r $(UNLIKELYNAME) |
104 |
|
|
mkdir $(UNLIKELYNAME) |
105 |
|
|
ln -s .. $(UNLIKELYNAME)/$(BASENAME) |
106 |
|
|
cd $(UNLIKELYNAME) && tar cfvzp ../$(BASENAME).tar.gz --exclude='CVS' --exclude='*.tar.gz' --exclude=$(UNLIKELYNAME) $(BASENAME)/* |
107 |
|
|
$(RM) -r $(UNLIKELYNAME) |
108 |
frodo |
368 |
|
109 |
|
|
.PHONY: test |
110 |
|
|
test: all |
111 |
|
|
./run-tests |