# 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=-8
CFLAGS=-g -O2 -Wall -DHAVE_GETOPT_LONG

all:	$(BIN)

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

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

install: $(MAN)
	install -s -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)
