#*****************************************************************************
#
#	Lee J Haywood's SliMer - slicing/merging of photographs.
#	Copyright (C) 2010 by Lee J Haywood.
#
#	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 3
#	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, see <http://www.gnu.org/licenses/>.
#
#*****************************************************************************
#
# Makefile : This file defines the compilation the source file with the SDL
#	     and SDL_image libraries.  It is intended for use in Linux,
#	     either for Linux or when cross-compiling for MS Windows.
#
#*****************************************************************************

# Define C compiler and options to use.
CC=gcc
CFLAGS=-Wall -O2 -pipe

# Get compiler options for SDL.
SDL_CFLAGS := $(shell sdl-config --cflags)
SDL_LDFLAGS := $(shell sdl-config --libs)

# Get compiler options for SDL for MS Windows (note hard-coded path).
SDLWIN_CFLAGS := $(shell /usr/local/microsoft/bin/sdl-config --cflags)
SDLWIN_LDFLAGS := $(shell /usr/local/microsoft/bin/sdl-config --libs)

# Build the Linux executable by default.
default : slimer

# Compilation for Linux.
slimer : slimer.c Makefile
	$(CC) -o slimer slimer.c \
		$(CFLAGS) \
		$(SDL_CFLAGS) \
		$(SDL_LDFLAGS) -L/usr/lib -L/usr/local/lib -lSDL_image \
		-DLINUX -g

# Compilation for MS Windows.
slimer.exe : slimer.c Makefile
	$(CC) -o slimer.exe slimer.c \
		$(CFLAGS) \
		$(SDLWIN_CFLAGS) \
		$(SDLWIN_LDFLAGS) \
		-L/usr/local/microsoft/lib -lSDL_image \
		-DWINDOWS

# Remove executables and intermediate/object files.
clean :
	rm -f slimer slimer.exe *.o

