| 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 | frodo | 265 | # For creating the archive | 
| 20 |  |  | PACKAGE=getopt | 
| 21 |  |  | VERSION=1.1.4 | 
| 22 |  |  | BASENAME=$(PACKAGE)-$(VERSION) | 
| 23 |  |  | UNLIKELYNAME=a8vwjfd92 | 
| 24 | frodo | 259 |  | 
| 25 |  |  | SHELL=/bin/sh | 
| 26 |  |  |  | 
| 27 |  |  | CC=gcc | 
| 28 |  |  | LD=ld | 
| 29 |  |  | RM=rm -f | 
| 30 |  |  | INSTALL=install | 
| 31 |  |  | MSGFMT=msgfmt | 
| 32 |  |  |  | 
| 33 |  |  | LANGUAGES = cs de es fr it ja nl pt_BR | 
| 34 |  |  | MOFILES:=$(patsubst %,po/%.mo,$(LANGUAGES)) | 
| 35 |  |  |  | 
| 36 | frodo | 323 | CPPFLAGS=-DLIBCGETOPT=$(LIBCGETOPT) -DWITH_GETTEXT=$(WITH_GETTEXT) -DLOCALEDIR=\"$(localedir)\" -DNOT_UTIL_LINUX -Dprogram_invocation_short_name=\"$(PACKAGE)\"  -Dprogram_version=\"$(VERSION)\" | 
| 37 | frodo | 259 | ifeq ($(LIBCGETOPT),0) | 
| 38 |  |  | CPPFLAGS+=-I./gnu | 
| 39 |  |  | endif | 
| 40 |  |  | WARNINGS=-Wall \ | 
| 41 |  |  | -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual \ | 
| 42 |  |  | -Wcast-align -Wmissing-declarations \ | 
| 43 |  |  | -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ | 
| 44 |  |  | -Wnested-externs -Winline | 
| 45 |  |  | OPTIMIZE=-O3 -fno-strength-reduce | 
| 46 |  |  | CFLAGS=$(WARNINGS) $(OPTIMIZE) | 
| 47 |  |  | LDFLAGS= | 
| 48 |  |  |  | 
| 49 |  |  | sources=getopt.c | 
| 50 |  |  | ifeq ($(LIBCGETOPT),0) | 
| 51 |  |  | sources+=gnu/getopt.c gnu/getopt1.c | 
| 52 |  |  | endif | 
| 53 |  |  |  | 
| 54 |  |  | objects=$(sources:.c=.o) | 
| 55 |  |  |  | 
| 56 |  |  | binaries=getopt | 
| 57 |  |  |  | 
| 58 |  |  | .PHONY: all clean realclean | 
| 59 |  |  | all: $(binaries) all_po | 
| 60 |  |  |  | 
| 61 |  |  | clean: clean_po | 
| 62 |  |  | -$(RM) $(objects) $(binaries) | 
| 63 |  |  |  | 
| 64 |  |  | getopt: $(objects) | 
| 65 |  |  | $(CC) $(LDFLAGS) -o $@ $(objects) | 
| 66 |  |  |  | 
| 67 |  |  | install: getopt install_po | 
| 68 |  |  | $(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) | 
| 69 |  |  | $(INSTALL) -m 755 getopt $(DESTDIR)$(bindir) | 
| 70 |  |  | $(INSTALL) -m 644 getopt.1 $(DESTDIR)$(man1dir) | 
| 71 |  |  |  | 
| 72 |  |  | install_doc: | 
| 73 |  |  | $(INSTALL) -m 755 -d $(DESTDIR)$(getoptdir) | 
| 74 |  |  | $(INSTALL) -m 755 getopt-parse.bash getopt-parse.tcsh \ | 
| 75 |  |  | getopt-test.bash getopt-test.tcsh \ | 
| 76 |  |  | $(DESTDIR)$(getoptdir) | 
| 77 |  |  |  | 
| 78 |  |  | ifeq ($(WITH_GETTEXT),1) | 
| 79 |  |  | all_po: $(MOFILES) | 
| 80 |  |  | install_po: all_po | 
| 81 |  |  | $(INSTALL) -m 755 -d $(DESTDIR)$(localedir) | 
| 82 |  |  | for lang in $(LANGUAGES) ; do \ | 
| 83 |  |  | dir=$(localedir)/$$lang/LC_MESSAGES; \ | 
| 84 |  |  | $(INSTALL) -m 755 -d $(DESTDIR)$$dir ;\ | 
| 85 |  |  | $(INSTALL) -m 644 po/$$lang.mo $(DESTDIR)$$dir/getopt.mo  ;\ | 
| 86 |  |  | done | 
| 87 |  |  | clean_po: | 
| 88 |  |  | $(RM) $(MOFILES) | 
| 89 |  |  | else | 
| 90 |  |  | all_po: | 
| 91 |  |  | install_po: | 
| 92 |  |  | clean_po: | 
| 93 |  |  | endif | 
| 94 |  |  |  | 
| 95 |  |  | %.o: %.c | 
| 96 |  |  | $(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c -o $*.o | 
| 97 |  |  |  | 
| 98 |  |  | %.mo: %.po | 
| 99 |  |  | $(MSGFMT) -o $@ $< | 
| 100 | frodo | 265 |  | 
| 101 |  |  | # You need GNU tar for this to work! | 
| 102 |  |  | .PHONY: package | 
| 103 |  |  | package: clean | 
| 104 |  |  | $(RM) -r $(UNLIKELYNAME) | 
| 105 |  |  | mkdir $(UNLIKELYNAME) | 
| 106 |  |  | ln -s .. $(UNLIKELYNAME)/$(BASENAME) | 
| 107 |  |  | cd $(UNLIKELYNAME) && tar cfvzp ../$(BASENAME).tar.gz --exclude='CVS' --exclude='*.tar.gz' --exclude=$(UNLIKELYNAME) $(BASENAME)/* | 
| 108 |  |  | $(RM) -r $(UNLIKELYNAME) |