# TinyPTC SDL v0.3.2 Makefile
# Copyright (C) 2000-2003 Alessandro Gatti <a.gatti@tiscali.it>
#
# http://sourceforge.net/projects/tinyptc/
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

CFLAGS     = -Wall -ansi -pedantic -Os
CC         = gcc
CPP        = cpp
LFLAGS     = -s
LD         = gcc
AFLAGS     = -f elf
AR         = ar
RANLIB     = ranlib
STRIP      = strip
RM         = /bin/rm -f
INCLUDES   = -I/usr/local/include -I/usr/X11R6/include `sdl-config --cflags` `sdl11-config --cflags`
LIBS       = -L/usr/local/lib -L/usr/X11R6/include `sdl-config --libs` `sdl11-config --libs`
CSOURCES   = test.c sdl.c
COBJECTS   = $(CSOURCES:.c=.o)
EXECUTABLE = tinyptc_test
LIBRARY    = libtinyptc.a

$(EXECUTABLE): $(COBJECTS) $(LIBRARY)
	$(LD) $(LDFLAGS) $(COBJECTS) $(LIBS) -o $(EXECUTABLE)
	$(STRIP) --strip-all $(EXECUTABLE)
	$(STRIP) --remove-section=".comment" $(EXECUTABLE)
	$(STRIP) --remove-section=".note" $(EXECUTABLE)

$(LIBRARY): $(COBJECTS) $(AOBJECTS)
	$(AR) cru $(LIBRARY) $(COBJECTS)
	$(RANLIB) $(LIBRARY)

%.o: %.c
	$(CC) $(CFLAGS) $(INCLUDES) -c $<

.depend:
	$(RM) .depend 2> /dev/null
	makedepend -f- -- $(INCLUDES) $(CFLAGS) $(CSOURCES) > .depend 2> /dev/null

clean:
	$(RM) $(EXECUTABLE) $(LIBRARY) $(COBJECTS) .depend

include .depend
