#
# makefile - htp
#
# HTML pre-processor
# Copyright (c) 2002 Jochen Hoenicke
#

TOP=..

#
# object files used
#
SRC = htp.c bool-proc.c def-proc.c defs.c file-proc.c gif.c html.c \
  htp-files.c image-proc.c image.c jpeg.c macro.c misc-proc.c msg.c \
  option.c png.c set-proc.c snprintf.c streams.c suballoc.c textfile.c \
  use-proc.c util.c varstore.c ver.c while-proc.c
HEADERS = bool-proc.h def-proc.h defs.h file-proc.h gif.h html.h \
  htp-files.h htp.h image-proc.h image.h jpeg.h macro.h misc-proc.h \
  msg.h option.h os.h png.h set-proc.h snprintf.h streams.h suballoc.h \
  textfile.h use-proc.h varstore.h ver.h while-proc.h

OBJ = $(SRC:%.c=%.$(OBJEXT))

DISTFILES = Makefile $(SRC) $(HEADERS) LICENSE.txt

include $(TOP)/Makefile.config

all: $(MAINEXE)

.PHONY: make-version
make-version:
	echo '#define VER_STRING "$(FULLVERSION)"' > version.inc
	echo '#define PROGRAM_NAME "$(MAIN)"' >> version.inc

install-bin: $(MAINEXE)
	mkdir -p $(bindir)
	$(INSTALL) -s $(MAINEXE) $(bindir)

#
# explicit dependency: final executable
#
$(MAINEXE) : make-version $(OBJ)
	$(LINK) -o$@ $(OBJ) $(LOPT)

#
# implicit dependencies for source code
#
%.$(OBJEXT) : %.c
	$(CC) $(CCOPT) $(DEFINES) -o$*.$(OBJEXT) $<

do-clean:
	rm -f *~ $(MAINEXE) *.$(OBJEXT)
