# Makefile for the SGE library examples

include ../Makefile.conf


CFLAGS += $(SGE_CFLAGS) -I./../

# Change -L./../ to the directory with libSGE.a
# If you have a shared version of SGE (libSGE.so) you don't really need to link
# to any other library than SGE (but it's no-ops).
LIBS =-L./../ -lSGE $(SGE_LIBS)

TARGETS = fire bitmapfont collision blib rotate speedtest

ifneq ($(NOTTF),y)
  TARGETS += basics blitting input alpha
endif

ifeq ($(USE_IMG),y)
  TARGETS += sfont
endif

ifneq ($(NO_CLASSES),y)
  TARGETS += sprite sprite2
  ifneq ($(NOTTF),y)
    TARGETS += inputdeluxe
  endif
endif

OBJECTS = $(addsuffix .o, $(TARGETS))

ifeq ($(C_ONLY),y)
  all:	basics_c
else
  all:	$(TARGETS)
endif


$(TARGETS):	%:%.o
	$(CXX) -o $@ $< $(LIBS)		

$(OBJECTS):	%.o:%.cpp
	$(CXX) $(CFLAGS) -c $< 	

strip:	all
	@strip $(TARGETS)

# The c example
basics_c:	%:%.o
	$(CC) -o $@ $< $(LIBS)

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


clean:
	@rm -f *.o fire bitmapfont collision blib rotate basics blitting input alpha sfont sprite sprite2 inputdeluxe basics_c speedtest
