# Makefile for deroff
# $Id: Makefile,v 1.3 1999/10/10 19:08:05 david Exp $

prefix=/usr
LEXSRC=deroff.l
SRC=$(LEXSRC:.l=.c)
BIN=$(LEXSRC:.l=)
MAN=$(LEXSRC:.l=.1)

LFLAGS=-Ca -f -8
CFLAGS=-g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
CFLAGS += -Wall -Wstrict-prototypes -Wmissing-prototypes\
 -Wmissing-declarations -Wbad-function-cast -Wnested-externs\
 -Wcast-qual -Wcast-align -Wshadow -Wwrite-strings -Wpointer-arith\
 -Wformat\
 -DHAVE_GETOPT_LONG

INSTOPT=
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTOPT += -s
endif

all:	$(BIN)

$(SRC): $(LEXSRC)
	$(LEX) $(LFLAGS) -t $^ > $@

$(BIN): $(SRC)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

install: $(MAN)
	install $(INSTOPT) -o root -g root -m 755 $(BIN) $(prefix)/bin
	install -o root -g root -m 644 $(MAN) $(prefix)/share/man/man1

clean:
	$(RM) *.o $(SRC) $(BIN)

distclean: clean
	$(RM) $(BIN)
