# Author: Tobi Vollebregt

#   Blobland 2, a 2D space shooter made for the SpeedHack 2002-B competition.
#   Copyright (C) 2002,2003  Tobi Vollebregt
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#   See `License.txt', which contains a verbatim copy of the
#   GNU General Public License, for details.
#
#   Please send your reaction to: tobivollebregt@hotmail.com
#
#
#   Makefile targets:
#	make [all]      Make blobland.exe.
#	make clean      Remove object files generated while compiling.
#	make distclean  Remove object files and blobland.exe.
#	make compress   Make blobland.exe and compress it with UPX.

.PHONY: all clean distclean compress

SRC=blobland.cpp demo.c
OBJ=$(addsuffix .o,$(basename $(SRC)))
EXE=blobland$(EXE_SUFFIX)

ifdef DJGPP
CXX=gpp
EXE_SUFFIX=.exe
LD=gpp
LDLIBS=-lalleg
else
CXX=g++
EXE_SUFFIX=
LD=g++
LDLIBS=`allegro-config --libs`
endif

ifdef DEBUGMODE
CFLAGS=-W -Wall -g
CPPFLAGS=-DDEBUGMODE=1
CXXFLAGS=-W -Wall -g
LDFLAGS=
else
CFLAGS=-O3
CPPFLAGS=
CXXFLAGS=-O3
LDFLAGS=-s
endif

CC=gcc
RM=rm -f
UPX_BIN=upx$(EXE_SUFFIX)

all: $(EXE) ;
$(EXE): $(OBJ)
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
%.o: %.cpp
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $^
%.o: %.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $^
clean:
	$(RM) $(OBJ)
distclean: clean
	$(RM) $(EXE)
compress:
	$(UPX_BIN) $(EXE)
