# MorphOS makefile. Tested with g++ 4.0.4. Older versions may or may not work.
#
PREFIX =
WFLAGS =  -Wall -Wshadow -Wformat-security -Wpointer-arith -Wcast-align -Wredundant-decls -Werror -Wconversion -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-long-long
CXXFLAGS = -O2 -MMD -pedantic -ansi $(GCC_MARCH) $(WFLAGS) -I. -I/gg/new-include -noixemul
LFLAGS = -noixemul
LIB_EXT = a

EXPORT_HEADERS = tablegenerator.hpp tablestrategy.hpp
ODIR = obj
_OBJ = tablegenerator.o simpletable.o framedtable.o space3table.o shadowtable.o helpers.o htmltable.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
LIBNAME = libtablegenerator.$(LIB_EXT)

all:		$(LIBNAME)

$(ODIR)/%.o:	%.cpp $(DEPS)
		$(CXX) -c -o $@ $< $(CXXFLAGS)

$(LIBNAME):	$(OBJ)
		ar cru $@ $(OBJ)
		ranlib $@
clean:
		rm -f $(ODIR)/*.d *~ core* $(ODIR)/*.o test *.a *.so

-include $(ODIR)/*.d

install:	all
		cp $(LIBNAME) $(PREFIX)/lib
		cp $(EXPORT_HEADERS) $(PREFIX)/include

test:		$(ODIR)/test.o $(LIBNAME)
		$(CXX) -o $@ $< $(LFLAGS) -L. -ltablegenerator -I.