include Makefile.inc

THISLIB	= FFI
SEARCH	= -P../IOExtras -P$(LOW) -P../PreludeIO -P../$(MACHINE)
ifeq "$(BUILDWITH)" "hbc"
EXTRA_H_FLAGS	= +RTS -A16M -RTS
else
EXTRA_H_FLAGS	=
endif
EXTRA_C_FLAGS	=

ifeq "${BUILDWITH}" "ghc"
ifeq "${TPROF}" "z"
EXTRA_H_FLAGS = +RTS -K2M -RTS
endif
endif

SRCS	= \
	Addr.hs ForeignObj.hs Ptr.hs Int.hs Word.hs CError.hs StablePtr.hs
SRCS_T	= \
	Addr.hs ForeignObj.hs Ptr.hs Int.hs Word.hs CError.hs


# Here are the main rules.
include ../Makefile.common


# Here are some extra rules.
Int.hs: Int.hs.cpp
	$(CC) -E $< >$@
Word.hs: Word.hs.cpp
	$(CC) -E $< >$@


# Here are the dependencies.

# dependencies generated by hmake -Md: (and hacked by MW)
#${OBJDIR}/Addr.$O: ${OBJDIR}/ShowsIntBase.$O 
#
#Addr.c: ShowsIntBase.c 

## Yucky .hi stuff to deal with mutual dependencies.
IOHIFILES =  FixIO UnsafePerformIO
IOHIS     = $(patsubst %,../IOExtras/%.${HISUFFIX},${IOHIFILES})

${OBJ_MAIN}:   ../IOExtras/FixIO.${HISUFFIX}
${CFILE_MAIN}: ../IOExtras/FixIO.${HISUFFIX}
${IOHIS}: ../IOExtras/%.${HISUFFIX} : ../IOExtras/%.hs
	cd ../IOExtras; ${MAKE} $@

../IOExtras/FixIO.${HISUFFIX}: ../IOExtras/UnsafePerformIO.${HISUFFIX}


