1 |
frodo |
259 |
.SUFFIXES: |
2 |
|
|
|
3 |
|
|
DESTDIR= |
4 |
|
|
prefix=/usr/local |
5 |
|
|
bindir=$(prefix)/bin |
6 |
|
|
mandir=$(prefix)/man |
7 |
|
|
man1dir=$(mandir)/man1 |
8 |
|
|
libdir=$(prefix)/lib |
9 |
|
|
sharedir=$(prefix)/share |
10 |
|
|
getoptdir=$(libdir)/getopt |
11 |
|
|
localedir=$(sharedir)/locale |
12 |
|
|
|
13 |
|
|
# Define this to 0 to use the getopt(3) routines in this package. |
14 |
|
|
LIBCGETOPT=1 |
15 |
|
|
|
16 |
|
|
# Define this to 1 if you do not have the gettext routines |
17 |
|
|
WITHOUT_GETTEXT=0 |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
SHELL=/bin/sh |
22 |
|
|
|
23 |
|
|
CC=gcc |
24 |
|
|
LD=ld |
25 |
|
|
RM=rm -f |
26 |
|
|
INSTALL=install |
27 |
|
|
MSGFMT=msgfmt |
28 |
|
|
|
29 |
|
|
LANGUAGES = cs de es fr it ja nl pt_BR |
30 |
|
|
MOFILES:=$(patsubst %,po/%.mo,$(LANGUAGES)) |
31 |
|
|
|
32 |
|
|
CPPFLAGS=-DLIBCGETOPT=$(LIBCGETOPT) -DWITH_GETTEXT=$(WITH_GETTEXT) -DLOCALEDIR=\"$(localedir)\" -DNOT_UTIL_LINUX |
33 |
|
|
ifeq ($(LIBCGETOPT),0) |
34 |
|
|
CPPFLAGS+=-I./gnu |
35 |
|
|
endif |
36 |
|
|
WARNINGS=-Wall \ |
37 |
|
|
-W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual \ |
38 |
|
|
-Wcast-align -Wmissing-declarations \ |
39 |
|
|
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ |
40 |
|
|
-Wnested-externs -Winline |
41 |
|
|
OPTIMIZE=-O3 -fno-strength-reduce |
42 |
|
|
CFLAGS=$(WARNINGS) $(OPTIMIZE) |
43 |
|
|
LDFLAGS= |
44 |
|
|
|
45 |
|
|
sources=getopt.c |
46 |
|
|
ifeq ($(LIBCGETOPT),0) |
47 |
|
|
sources+=gnu/getopt.c gnu/getopt1.c |
48 |
|
|
endif |
49 |
|
|
|
50 |
|
|
objects=$(sources:.c=.o) |
51 |
|
|
|
52 |
|
|
binaries=getopt |
53 |
|
|
|
54 |
|
|
.PHONY: all clean realclean |
55 |
|
|
all: $(binaries) all_po |
56 |
|
|
|
57 |
|
|
clean: clean_po |
58 |
|
|
-$(RM) $(objects) $(binaries) |
59 |
|
|
|
60 |
|
|
getopt: $(objects) |
61 |
|
|
$(CC) $(LDFLAGS) -o $@ $(objects) |
62 |
|
|
|
63 |
|
|
install: getopt install_po |
64 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) |
65 |
|
|
$(INSTALL) -m 755 getopt $(DESTDIR)$(bindir) |
66 |
|
|
$(INSTALL) -m 644 getopt.1 $(DESTDIR)$(man1dir) |
67 |
|
|
|
68 |
|
|
install_doc: |
69 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(getoptdir) |
70 |
|
|
$(INSTALL) -m 755 getopt-parse.bash getopt-parse.tcsh \ |
71 |
|
|
getopt-test.bash getopt-test.tcsh \ |
72 |
|
|
$(DESTDIR)$(getoptdir) |
73 |
|
|
|
74 |
|
|
ifeq ($(WITH_GETTEXT),1) |
75 |
|
|
all_po: $(MOFILES) |
76 |
|
|
install_po: all_po |
77 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(localedir) |
78 |
|
|
for lang in $(LANGUAGES) ; do \ |
79 |
|
|
dir=$(localedir)/$$lang/LC_MESSAGES; \ |
80 |
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$$dir ;\ |
81 |
|
|
$(INSTALL) -m 644 po/$$lang.mo $(DESTDIR)$$dir/getopt.mo ;\ |
82 |
|
|
done |
83 |
|
|
clean_po: |
84 |
|
|
$(RM) $(MOFILES) |
85 |
|
|
else |
86 |
|
|
all_po: |
87 |
|
|
install_po: |
88 |
|
|
clean_po: |
89 |
|
|
endif |
90 |
|
|
|
91 |
|
|
%.o: %.c |
92 |
|
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c -o $*.o |
93 |
|
|
|
94 |
|
|
%.mo: %.po |
95 |
|
|
$(MSGFMT) -o $@ $< |