
##
## full path of the frac libraries (please adapt)
##
FRACLIB=/usr/local/tina/frac-2.2.2/lib/

##
## 
##

##
## specify HOSTTYPE if not already declared, e.g. on
## Windows you can just uncomment the following line
##
HOSTTYPE=i386-linux


# specify a store library
STORE=/avl

# default compiler to gcc
CC=gcc

# default optimizations flags
OPTFLAGS=-O2
CFLAGS=-m32

# target dependent
ifeq ($(HOSTTYPE),i86pc-64)
# x86 solaris 64 bit
EXT=.so
SHFLG=-shared -fPIC -fpic -static-libgcc
CFLAGS=-m64
else
ifeq ($(HOSTTYPE),i86pc)
# x86 solaris 32 bit
EXT=.so
SHFLG=-shared -fPIC -fpic -static-libgcc
else
ifeq ($(HOSTTYPE),sparc)
# sparc solaris 32 bit
EXT=.so
SHFLG=-G -fPIC -fpic
else
ifeq ($(HOSTTYPE),i386-linux)
# intel linux 32 bit
EXT=.so
SHFLG=-shared -fPIC -fpic
else
ifeq ($(HOSTTYPE),x86_64-linux)
# intel linux 64 bit
EXT=.so
SHFLG=-shared -fPIC -fpic
CFLAGS=-m64
else
ifeq ($(HOSTTYPE),powermac)
# macppc 32 bit
EXT=.dylib
SHFLG=-m32 -dynamiclib -flat_namespace -undefined suppress -fPIC -fno-common
else
ifeq ($(HOSTTYPE),intel-pc)
# macintel 32 bit
EXT=.dylib
SHFLG=-m32 -dynamiclib
else
ifeq ($(HOSTTYPE),intel-pc-64)
# macintel 64 bit
EXT=.dylib
SHFLG=-m64 -dynamiclib
CFLAGS=-m64
else
ifeq ($(HOSTTYPE),x64-mswin)
# mingw 64 bit cross compiled
EXT=.dll
SHFLG=-shared
CFLAGS=-b x86_64-w64-mingw32 -m64
CDEFS=-DMINGW
else
ifeq ($(HOSTTYPE),i386-mswin)
# mingw 32 bit, please adapt if using another gcc
EXT=.dll
SHFLG=-shared
HOSTTYPE=i386-mswin
CDEFS=-DMINGW
STORE=/avl
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif

# used for packing distributions
flags:
	@echo \# $(HOSTTYPE) specific
	@echo EXT=$(EXT)
	@echo SHFLG=$(SHFLG)
	@echo CFLAGS=$(CFLAGS)
	@echo CDEFS=$(CDEFS)

# compiles the library into the tts
%.tts: %.fcr
	frac $< $@
	$(CC) $(CFLAGS) $(CDEFS) $(OPTFLAGS) -o  $(join $@, /$(basename $(notdir $@))$(EXT)) $(SHFLG) -I $(FRACLIB) -I $(FRACLIB)$(STORE) $(join $@, /$(basename $(notdir $@)).c) $(CLIBS)
