summaryrefslogtreecommitdiffstats
path: root/getopt-1.0.3b/Makefile
blob: 92e99e9de2efc9956e4d7c632c0f50b732f6f16d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.SUFFIXES:

include ../make_include
include ../MCONFIG

GETOPTDIR=$(USRLIBDIR)/getopt

# Define this to 0 to use the getopt(3) routines in this package.
LIBCGETOPT=1

SHELL=/bin/sh

LD=ld
RM=rm -f
INSTALL=install

CPPFLAGS=-DLIBCGETOPT=$(LIBCGETOPT)
ifeq ($(LIBCGETOPT),0)
CPPFLAGS+=-I./gnu
endif

# -Wcast-align causes problems with the identifier stderr on alpha's
# with an old glibc.
# -Wbad-function-cast and -Wmissing-declarations are unknown for gcc 2.5.8.
WARNINGS=-Wall \
         -W -Wshadow -Wpointer-arith -Wcast-qual \
         -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
         -Wnested-externs -Winline
CFLAGS=$(WARNINGS) $(OPT)

SOURCES=getopt.c
ifeq ($(LIBCGETOPT),0)
SOURCES+=gnu/getopt.c gnu/getopt1.c
endif

OBJECTS=$(SOURCES:.c=.o)

BINARIES=getopt

.PHONY: all clean realclean 
all: $(BINARIES)

clean:
	-$(RM) $(OBJECTS) $(BINARIES) 

getopt: $(OBJECTS)
	$(CC) $(LDFLAGS) $< -o $@

install: getopt
	$(INSTALLDIR) $(USRBINDIR) $(MAN1DIR) $(GETOPTDIR)
	$(INSTALLBIN) getopt $(USRBINDIR)
	$(INSTALLMAN) getopt.1 $(MAN1DIR)
	$(INSTALLBIN) parse.bash parse.tcsh test.bash test.tcsh $(GETOPTDIR)