| 1 | .SUFFIXES: | 
| 2 |  | 
| 3 | include ../make_include | 
| 4 | include ../MCONFIG | 
| 5 |  | 
| 6 | GETOPTDIR=$(USRSHAREMISCDIR)/getopt | 
| 7 |  | 
| 8 | # Define this to 0 to use the getopt(3) routines in this package. | 
| 9 | LIBCGETOPT=1 | 
| 10 |  | 
| 11 | SHELL=/bin/sh | 
| 12 |  | 
| 13 | LD=ld | 
| 14 | RM=rm -f | 
| 15 | INSTALL=install | 
| 16 |  | 
| 17 | CPPFLAGS=-DLIBCGETOPT=$(LIBCGETOPT) | 
| 18 | ifeq ($(LIBCGETOPT),0) | 
| 19 | CPPFLAGS+=-I./gnu | 
| 20 | endif | 
| 21 |  | 
| 22 | # -Wcast-align causes problems with the identifier stderr on alpha's | 
| 23 | # with an old glibc. | 
| 24 | # -Wbad-function-cast and -Wmissing-declarations are unknown for gcc 2.5.8. | 
| 25 | WARNINGS=-Wall \ | 
| 26 | -W -Wshadow -Wpointer-arith -Wcast-qual \ | 
| 27 | -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ | 
| 28 | -Wnested-externs -Winline | 
| 29 | # CFLAGS= $(WARNINGS) $(OPT) | 
| 30 |  | 
| 31 | SOURCES=getopt.c | 
| 32 | ifeq ($(LIBCGETOPT),0) | 
| 33 | SOURCES+=gnu/getopt.c gnu/getopt1.c | 
| 34 | endif | 
| 35 |  | 
| 36 | OBJECTS=$(SOURCES:.c=.o) | 
| 37 |  | 
| 38 | BINARIES=getopt | 
| 39 |  | 
| 40 | .PHONY: all clean realclean | 
| 41 | all: $(BINARIES) | 
| 42 |  | 
| 43 | clean: | 
| 44 | -$(RM) $(OBJECTS) $(BINARIES) | 
| 45 |  | 
| 46 | getopt: $(OBJECTS) | 
| 47 | $(CC) $(LDFLAGS) $< -o $@ | 
| 48 |  | 
| 49 | install: getopt | 
| 50 | $(INSTALLDIR) $(USRBINDIR) $(MAN1DIR) $(GETOPTDIR) | 
| 51 | $(INSTALLBIN) getopt $(USRBINDIR) | 
| 52 | $(INSTALLMAN) getopt.1 $(MAN1DIR) | 
| 53 | $(INSTALLBIN) getopt-parse.bash getopt-parse.tcsh \ | 
| 54 | getopt-test.bash getopt-test.tcsh $(GETOPTDIR) |