unexport GNUMIPS
OBJS		=$(addprefix $(CUPATH)/,$(OBJECTS))
PROG		=$(notdir $(basename $(OUTPUT_NAME)))
OUTPUT_PATH	=$(dir $(basename $(OUTPUT_NAME)))
FEATURES	=$(subst :, ,$(patsubst -D_MY_FEATURES=%,%,$(filter -D_MY_FE%,$(FLAGS))))
CFLAGS		=$(patsubst -D_MY_FEATURES=%,,$(FLAGS))
SBD 		=$(patsubst -D_SBD=%,%,$(filter -D_SBD%,$(FLAGS)))
#CFLAGS		=$(patsubst -D_SBD=%,,$(CFLAGS))
CRT0FLAGS	=$(subst :, ,$(patsubst -D_CRT0FLAGS=%,-D%,$(filter -D_CRT0FL%,$(FLAGS))))
CFLAGS		:=$(patsubst -D_CRT0FLAGS=%,,$(CFLAGS))
DEPTH		=$(GNUMIPS)/sde/examples

ifneq (,$(findstring Ram,$(OUTPUT_PATH)))
	ALL =ram sa
	ifneq (,$(findstring Ttext,$(LDFLAGS)))
		ASSIGNRAMTEXT =1
	endif
else
	ALL =rom 
	ifneq (,$(findstring Ttext,$(LDFLAGS)))
		ASSIGNROMTEXT =1
	endif
endif			

#ifneq (,$(findstring 4kc,$(FLAGS)))
#	ifneq (,$(findstring EB,$(FLAGS)))
#		ifneq (,$(findstring MALTA,$(FLAGS)))
#			SBD =MALTA32BJ
#		endif
#		ifneq (,$(findstring ATLAS,$(FLAGS)))
#			SBD =ATLASLV4B
#		endif
#		ifneq (,$(findstring GNUSIM,$(FLAGS)))
#			SBD =GSIM32B
#		endif
#		ifneq (,$(findstring MIPSSIM,$(FLAGS)))
#			SBD =MSIM32B
#		endif
#		ifneq (,$(findstring OWN_BOARD,$(FLAGS)))
#			SBD =OWN
#		endif
#	endif
#	ifneq (,$(findstring EL,$(FLAGS)))
#		ifneq (,$(findstring MALTA,$(FLAGS)))
#			SBD =MALTA32LJ
#		endif
#		ifneq (,$(findstring ATLAS,$(FLAGS)))
#			SBD =ATLASLV4L
#		endif
#		ifneq (,$(findstring GNUSIM,$(FLAGS)))
#			SBD =GSIM32L
#		endif
#		ifneq (,$(findstring MIPSSIM,$(FLAGS)))
#			SBD =MSIM32L
#		endif
#		ifneq (,$(findstring OWN_BOARD,$(FLAGS)))
#			SBD =OWN
#		endif
#	endif
LDFLAGS	:=$(patsubst -mcpu=%,,$(LDFLAGS))
#endif

ifneq (,$(findstring r3000,$(FLAGS)))
	ifeq (,$(findstring GSIM,$(FLAGS)))
		ifeq (,$(findstring MSIM,$(FLAGS)))
			ALL =r3k
		endif
	endif
endif
	
#ifneq (,$(findstring r3000,$(FLAGS)))
#	ifneq (,$(findstring EB,$(FLAGS)))
#		ifneq (,$(findstring GNUSIM,$(FLAGS)))
#			ifneq (,$(findstring -mips16,$(LDFLAGS)))
#				SBD =GSIM16B
#			else
#			SBD =GSIM1B
#			endif
#		else
#			#SBD =R3KB
#			ALL =r3k
#		endif
#	endif
#	ifneq (,$(findstring EL,$(FLAGS)))
#		ifneq (,$(findstring GNUSIM,$(FLAGS)))
#			ifneq (,$(findstring -mips16,$(LDFLAGS)))
#				SBD =GSIM16L
#			else
#			SBD =GSIM1L
#			endif
#		else
#			#SBD =R3KL
#			ALL =r3k
#		endif
#	endif
#endif

ifneq (,$(filter %.cpp %.cxx %.cc,$(SRCNAME)))
	LOADLIBES =-lstdc++
endif

ifneq (,$(findstring mno-float,$(CFLAGS)))
FLOAT =no
CFLAGS :=$(filter-out -mno-float,$(CFLAGS))
LDLAGS :=$(filter-out -mno-float,$(LDFLAGS))
else
FLOAT =yes
CFLAGS :=$(filter-out -msoft-float,$(CFLAGS))
CFLAGS :=$(filter-out -mhard-float,$(CFLAGS))
LDFLAGS :=$(filter-out -msoft-float,$(LDFLAGS))
LDFLAGS :=$(filter-out -mhard-float,$(LDFLAGS))
endif

include make.mk
