#
# WIZ SDK for Cygwin / Version: 0.1
# GP2X WIZ Makefile by Rikku2000
#

#
#========================================(Config)
#

# Software Name
PROGRAM = demo.gpe

# Phat
WIZDIR := /devkitWIZ
WIZBIN := $(WIZDIR)/bin
WIZLIB := $(WIZDIR)/arm-open2x-linux/lib
WIZINC := $(WIZDIR)/arm-open2x-linux/include

# Compiler Name
ARCH := arm-open2x-linux-

# Compiler
CC := ${WIZBIN}/$(ARCH)gcc
CXX := ${WIZBIN}/$(ARCH)g++
STRIP := ${WIZBIN}/$(ARCH)strip

# Linker
LDFLAGS += -lSDL
CFLAGS += $(shell $(WIZBIN)/sdl-config --cflags)
CXXFLAGS += $(shell $(WIZBIN)/sdl-config --cflags)

# Include
INCLUDES := -I${WIZINC} -I${WIZINC}/SDL

# Libs
LIBS += $(shell $(WIZBIN)/sdl-config --libs)

#
#========================================(Files)
#

CFILES	= demo.c

#
#========================================(Compile)
#

OFILES = $(SFILES:.S=.o) $(CFILES:.c=.o)

$(PROGRAM):	$(OFILES)
			$(CXX) $(OFILES) $(LDFLAGS) -o $@
			$(STRIP) $(PROGRAM)

all: $(PROGRAM)

%.o: %.c
	 $(CC) $(ALL_INCLUDES) $(CFLAGS) -c $< -o $@ -lm -mcpu=arm926ej-s -mtune=arm926ej-s

clean:
	 -rm -f $(OFILES) $(MAPFILE) $(PROGRAM)