# Makefile for mhtml
#
# mhtml -- a program to mirror html pages recursively
# Copyright (C) 1996  Kevin M. Bealer
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
# USA.
# 
# You can send mail to the author at <kmb203@psu.edu> or:
# 
# Kevin M Bealer
# 94 Bowers Road
# Mertztown, PA 19539
#

COMPARGS=-Wall --pipe -O2

.PHONY: install
install: mhtml
	cp mhtml /usr/local/bin
	cp fetchfile /usr/local/bin
	strip /usr/local/bin/mhtml

mhtml: mhtml.o basic.o UrlConvert.o WebRef.o lex.yy.o basic.o
	g++ -o mhtml mhtml.o basic.o UrlConvert.o WebRef.o lex.yy.o

mhtml.o: mhtml.cc UrlConvert.h WebRef.h mhtml.h
	g++ $(COMPARGS) -c mhtml.cc

basic.o: basic.cc basic.h
	g++ $(COMPARGS) -c basic.cc

UrlConvert.o: UrlConvert.cc UrlConvert.h
	g++ $(COMPARGS) -c UrlConvert.cc

WebRef.o: WebRef.cc WebRef.h
	g++ $(COMPARGS) -c WebRef.cc

lex.yy.o: lex.yy.cc
	g++ $(COMPARGS) -c lex.yy.cc

lex.yy.cc: scanpage.fl WebRef.h
	flex scanpage.fl

.PHONY: clean
clean:
	rm --verbose --force *.o lex.yy.cc mhtml

.PHONY: cleanall
cleanall: clean
	rm --verbose --force *~
