#
# Makefile for Battlemines
# Auteur : Jeroen De Busser
# Datum : 2/4/2010
#

### MACRO'S ###

#Commands
RM = rm -f
CXX = g++ -g

#Program files to be generated
PROG = Battlemines
#List of source files
SRCS = main.cpp bombmap.cpp CGame.cpp CRenderer.cpp
#List of libraries
LIBS = -lallegro -lallegro_main -lallegro_primitives -lallegro_font -lallegro_ttf
#List of preprocesoor outputs
PRE = $(SRCS:.cpp=.cpp.pre)
#List of generated object files
OBJS = $(SRCS:.cpp=.o)

### MAKE RULES ###

#Compile and link everything
all : $(PROG)

#Preprocess
preprocess : $(PRE)

#Link
$(PROG): $(OBJS)
	$(CXX) $(OBJS) $(LIBS) -o $(PROG)

#Compile each cpp file
%.o: %.cpp
	$(CXX) -c --pedantic $< -o $@


#Preprocess each cpp file
%.cpp.pre: %.cpp
	$(CXX) -E $< -o $@
	

#Clean folder
clean:
	$(RM) *~ *.o *.cpp.pre $(PROG)

#Make TGZ
tgz: clean
	$(RM) $(PROG).tgz
	tar -czf $(PROG).tgz * .project .cproject
	chmod 644 $(PROG).tgz
