# Simple Makefile for generation of:
# MCUG3 sample application.
#
# ---------------------------------------------------------------------------
# (C) Copyright 2012 Roesch & Walter Industrie-Elektronik GmbH, Germany
#     support@rw-gmbh.de
# ---------------------------------------------------------------------------
#
# Changelog:
#	2012-08-02 binding against shared library (libmcug3.so)
#		   adding DO_NOT_PACK_MCUG3_H to CFLAGS when cross compiling for mipsel
#	2005-06-09 copied from sample01
# 
##################################################################
# !!!!! please set up KERNELDIR and INSTALLDIR !!!!!
##################################################################

LIBDIR=../mcug3lib

ifeq ($(shell uname -m),x86_64)
    LIBDIR := $(LIBDIR)/lib64
endif

LIBFILES = $(LIBDIR)/libmcug3.so

# setup prefix for crosscompiler
# CROSS_COMPILE=mipsel-linux-
# uncomment when not cross compiling
CROSS_COMPILE=

CC = $(CROSS_COMPILE)g++

ifeq ($(shell uname), CYGWIN_NT-5.0)
	# the cross compiler appends a exe suffix to the file name
	# using . at the end of filename solves this problem
	EXENAME = sample02.
else 
	EXENAME = sample02
endif

CFLAGS = -I$(LIBDIR) -O2 -Wall

ifeq (${CROSS_COMPILE}, mipsel-linux-)
	CFLAGS += -mips2
	CFLAGS += -DDO_NOT_PACK_MCUG3_H
endif


$(EXENAME): move.c $(OFILES) $(LIBFILES)
	$(CC) $(CFLAGS) move.c -o $(EXENAME) -L$(LIBDIR) -lmcug3

all: $(EXENAME)

clean:
	rm -f *.o *~ $(EXENAME)


