# libmenuthingy makefile (linux)
# v0.0.1 x86 (generic desktop computer)
# lots of things might need changing
# run `make x86-demo` to compile the demo, you will need to have compiled
#		and installed libmenuthing already

# install directories - shouldn't need to be changed on standard linux systems
LIB=/usr/lib
INCLUDE=/usr/include

CXXFLAGS=-lSDL_ttf -lSDL
BUILD=build
SOURCES=src

CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))

OBJ= $(CPPFILES:.cpp=.o)

# compile thingies
CXX=g++
AR=ar

export VPATH= $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))

OBJS=$(foreach obj,$(OBJ),$(BUILD)/$(obj))

libtmsdl.a: $(OBJS)
	@echo $(AR) rcs libmenuthing.a $(OBJ)
	@$(AR) rcs libmenuthing.a $(OBJS)

$(BUILD)/%.o: %.cpp
	@echo $(CXX) -c $(notdir $<) -o $(notdir $@)
	@$(CXX) -c $< -o $@

clean:
	rm -rf $(BUILD)/* libmenuthing.a
	rm -f *~
	mkdir $(BUILD)/demo

install:
	cp libmenuthing.a $(LIB)
	mkdir $(INCLUDE)/lmt
	cp $(SOURCES)/*.h $(INCLUDE)/lmt

x86-demo:
	$(CXX) $(SOURCES)/demo/demo.cpp -o ./demo -lSDL -lSDL_ttf -lmenuthing
