VERSION=1.0
CFLAGS=-DVERSION=\"$(VERSION)\" -Wall#-O2 #-DVERBOSE=1
CC= gcc
LDFLAGS= #-s # strip symbols, done while installing
GZIP= gzip
INSTALL= /usr/bin/ginstall -c

prefix=
manprefix=/usr

SOURCES= getdsr.c
EXECS= $(SOURCES:.c=)
MANS= $(SOURCES:.c=.1) 
MANGZ= $(SOURCES:.c=.1.gz)

.PHONY: all clean default install man

all default: $(EXECS) $(MANGZ)

clean:
	rm -f *.o *~ core $(EXECS) $(MANGZ)

man: $(MANGZ)

install: all
	for h in $(EXECS); do $(INSTALL) -m 755 $$h $(prefix)/bin/; done
	for h in $(MANGZ); do $(INSTALL) -m 644 $$h $(manprefix)/man/man1/; done

release: all clean
	(cd .. && tar czf getdsr-$(VERSION).tgz getdsr-$(VERSION) )
	cp -pu getdsr-$(VERSION).lsm ..

getdsr: getdsr.c Makefile
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

getdsr.1.gz: getdsr.1 
	$(GZIP) -c $< >$@


#avoid implicit checking
Makefile:
	@echo Error

$(SOURCES) $(MANS):
	@echo Error: sources not found
