summaryrefslogtreecommitdiffstats
path: root/contrib/csup/GNUmakefile
blob: 7aceccdbd37beb80ed0599b126fab0d450c4dc36 (plain)
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
54
55
56
57
58
59
60
61
62
63
# A simple gmake Makefile, to be used on Linux and Darwin.  It shouldn't
# be used elsewhere because it assumes that the target system doesn't
# support BSD extended file flags.
#
# $FreeBSD$
#

PREFIX?=/usr/local
OWNER?=	0
GROUP?=	0

UNAME=	$(shell uname -s)

SRCS=	attrstack.c config.c detailer.c diff.c fattr.c fixups.c fnmatch.c \
	globtree.c idcache.c keyword.c lister.c main.c misc.c mux.c pathcomp.c \
	parse.c proto.c status.c stream.c threads.c token.c updater.c
OBJS=	$(SRCS:.c=.o)

WARNS=	-Wall -W -Wno-unused-parameter -Wmissing-prototypes -Wpointer-arith \
	-Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow \
	-Wcast-align -Wunused-parameter -Wchar-subscripts -Winline \
	-Wnested-externs -Wredundant-decls -Wno-format-y2k

CFLAGS+= -g -O -pipe -DNDEBUG -I$(PREFIX)/include
ifeq ($(UNAME), Linux)
	CFLAGS+= -D_XOPEN_SOURCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
endif
ifeq ($(UNAME), Darwin)
	CFLAGS+= -DHAVE_FFLAGS
endif
CFLAGS+= $(WARNS)
LDFLAGS= -L$(PREFIX)/lib -lcrypto -lz -lpthread

.PHONY: all clean install

all: csup csup.1.gz

csup: $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

config.c: parse.h

token.c: token.l

parse.c: parse.y

parse.h: parse.c

clean:
	rm -f csup $(OBJS) parse.c parse.h token.c csup.1.gz

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

%.c: %.y
	$(YACC) -d -o $@ $<

csup.1.gz: csup.1
	gzip -cn $< > $@

install: csup csup.1.gz
	install -s -o $(OWNER) -g $(GROUP) csup $(PREFIX)/bin
	install -s -o $(OWNER) -g $(GROUP) csup.1.gz $(PREFIX)/share/man/man1
OpenPOWER on IntegriCloud