.SUFFIXES:
.SUFFIXES: .c .o
.PHONY: all clean ment archiv

.c.o:
	gcc -Wall -c -g -ggdb $<

#ALL = xhtml htmfa htmlink htmluri htmhasonl filenev
ALL = htmlink htmhasonl

all :	$(ALL)

xhtml	: main.o htmfa.o tag.o xhtml.o listkozos.o tagki.o
	gcc -Wall -o $@ $^ #/usr/local/lib/libgyl.so.1
	strip $@

htmfa	: main.o htmfa.o tag.o listfa.o listkozos.o tagki.o
	gcc -Wall -o $@ $^ #/usr/local/lib/libgyl.so.1
	strip $@

htmlink	: htmlink.o htmfa.o tag.o listkozos.o uriki.o filenev.o
	gcc -Wall -o $@ $^
	strip $@

htmluri	: htmlink.c
	gcc -DDEBUG -Wall -o $@ $^
	strip $@

htmhasonl	: htmhasonl.o
#	gcc -Wall -o $@ $^ /usr/local/lib/libgyl.so.1
	gcc -Wall -o $@ $^ -l gyim
	strip $@

filenev	: filenev.c
	gcc -DMAIN -Wall -o $@ $^
	strip $@

clean	:
	rm -f *.o $(ALL)

ment	:
	tar czvf htmfa.tgz *.c *.h [mM]akefile p xh xh.sed *.xhtml *.xsd xsd xhtml debian

CSNEV = htmfa
VERZIO = 1.0
VERZDIR = $(CSNEV)-$(VERZIO)
ALVER   = 1

BINDIR = /usr/local/bin
BINNEV = htmlink htmhasonl

MANDIR = /usr/share/man/hu/man1
MANNEV = htmlink.1
 
# make htmfa_1.0-1_amd64.deb
$(CSNEV)_$(VERZIO)-${ALVER}_amd64.deb : $(MIND) $(MANNEV) debian/control
	rm -rf $(VERZDIR)
	mkdir $(VERZDIR)
	cp -p htmlink.c htmfa.c tag.c listkozos.c uriki.c filenev.c htmhasonl.c *.h Makefile ${BINNEV} $(VERZDIR)
	for f in $(MANNEV) ; do cat $$f | gzip >$(VERZDIR)/$$f.gz ; done
	tar czvf $(CSNEV)_$(VERZIO).orig.tar.gz $(VERZDIR)
	cp -pr debian $(VERZDIR)
	cd $(VERZDIR) ; debuild -us -uc
#	rm -r $(VERZDIR)

install :
	install -d $(DESTDIR)/${BINDIR} $(DESTDIR)/${MANDIR}
	cp -p $(MIND) ${BINNEV} $(DESTDIR)/${BINDIR}
	cp -p *.1.gz $(DESTDIR)/${MANDIR}

