#!/usr/bin/make -f

default: all

# DESTDIR is for GNU Autotools compatibility...
DESTDIR ?= /
prefix ?= usr/local

INSTALL_DEST = $(shell echo $(DESTDIR)/$(prefix)/include/s11n.net/lext | sed -e 's/\/\//\//g')

INSTALL_HEADERS = lex_t.hpp
DIST_FILES = Makefile README lex_t.hpp configure doxy.make index.txt Doxyfile.at test.cpp


PACKAGE_VERSION = 2004.12.31
PACKAGE_NAME = libs11n_lex_t++
PACKAGE_FULL_NAME = $(PACKAGE_NAME)-$(PACKAGE_VERSION)


dist:
	-rm -fr $(PACKAGE_FULL_NAME)
	mkdir $(PACKAGE_FULL_NAME)
	cp $(DIST_FILES) $(PACKAGE_FULL_NAME)
	tar czf $(PACKAGE_FULL_NAME).tar.gz $(PACKAGE_FULL_NAME)
	rm -fr $(PACKAGE_FULL_NAME)



$(INSTALL_DEST):
	test -d $@ && exit 0; \
		mkdir -p $@

install: $(INSTALL_DEST)
	cp $(INSTALL_HEADERS) $(INSTALL_DEST)



include doxy.make
doxynotes:
ifneq (,$(DOXYGEN_BIN))
	@echo "To build the API docs using doxygen run 'make doxygen'."
else
	@echo "If you will install doxygen in your PATH you may build the API docs by running 'make doxygen'"
endif

CLEAN_FILES += $(wildcard *~ $(PACKAGE_FULL_NAME) $(PACKAGE_FULL_NAME).tar.gz test *.o Doxyfile html latex)
ifneq (,$(CLEAN_FILES))
clean:
	-rm -fr $(CLEAN_FILES)
else
clean:
endif



instr:
	@echo -e "This directory needs no special building. \
To install it run:\n\
\t${MAKE} install [prefix=some/prefix] [DESTDIR=/some_root]\n\
The header(s) will be installed to DESTDIR/prefix/include/s11n.net/lext\n\
Defaults:\n\
\tDESTDIR=$(DESTDIR)\n\
\tprefix=$(prefix)"


all: instr doxynotes

test: test.cpp lex_t.hpp Makefile
	gcc -o test test.cpp -lstdc++
	./test


