/[public]/getopt/trunk/Makefile
ViewVC logotype

Contents of /getopt/trunk/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 325 - (show annotations)
Tue Jul 31 19:53:07 2012 UTC (12 years, 4 months ago) by frodo
File size: 2616 byte(s)
(Frodo) Fix several issues when compiling without gettext support

1 .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 getoptdir=$(sharedir)/getopt
10 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 # For creating the archive
19 PACKAGE=getopt
20 VERSION=1.1.4
21 BASENAME=$(PACKAGE)-$(VERSION)
22 UNLIKELYNAME=a8vwjfd92
23
24 SHELL=/bin/sh
25
26 CC=gcc
27 LD=ld
28 RM=rm -f
29 INSTALL=install
30 MSGFMT=msgfmt
31
32 LANGUAGES = cs de es fr it ja nl pt_BR
33 MOFILES:=$(patsubst %,po/%.mo,$(LANGUAGES))
34
35 CPPFLAGS=-DLIBCGETOPT=$(LIBCGETOPT) -DWITHOUT_GETTEXT=$(WITHOUT_GETTEXT) -DLOCALEDIR=\"$(localedir)\" -DNOT_UTIL_LINUX -Dprogram_invocation_short_name=\"$(PACKAGE)\" -Dprogram_version=\"$(VERSION)\"
36 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 ifeq ($(WITHOUT_GETTEXT),0)
78 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
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)

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26