#
# platform_specific_flags.mk.x86_64-darwin
#
# This file is included in other Makefiles and defines
# platform specific macros

TMAP_LOCAL = /usr/local/src/FERRET

INCLUDES        = -I/usr/include \
		  -I/usr/X11R6/include \
		  -I/usr/local/include \
		  -I$(TMAP_LOCAL)/src/xgks/include \
		  -I. \
		  -I$(TMAP_LOCAL)/xgks/gif \
		  -I$(TMAP_LOCAL)/xgks/ps \
		  -I$(TMAP_LOCAL)/xgks/port \
                  -I$(TMAP_LOCAL)/xgks/src/lib \
                  -I$(TMAP_LOCAL)/xgks/src/lib/gksm \
		  -I$(TMAP_LOCAL)/include \
                  -Ipplinc/xgks \
		  -I../common \
		  -I$(TMAP_LOCAL)/fmt/cmn \
		  -I$(TMAP_LOCAL)/ppl/include \
		  -I$(TMAP_LOCAL)/fer/common

FINCLUDES	= -I$(TMAP_LOCAL)/ppl/tmap_inc \
		  -I../include \
		  -I$(TMAP_LOCAL)/fmt/cmn \
		  -I../common \
		  -I$(TMAP_LOCAL)/ppl/include \
		  -I$(TMAP_LOCAL)/fer/common

GUI_INCLUDES	= -I/usr/X11R6/include
 
# New platform type var - *kob* 10/01
PLATFORM := $(shell uname -rs)

CC              = gcc
FC		= gfortran
F77		= gfortran
RANLIB          = /usr/bin/ranlib

# Flags for compiling all the C code
# have to remove -02 flag due to bug in v2.96 of compiler. see
#   for http://gcc.gnu.org/ml/gcc-bugs/2000-04/msg00716.html for info
CFLAGS          = -g -arch x86_64 -fPIC -Dlint -Dunix -DNEED_IAND -DFORTRAN_90 -DVOID_SIGHANDLER -D_POSIX_VERSION -DFULL_GUI_VERSION -DX_REFRESH -DXT_CODE $(INCLUDES)

# Flags for compiling the PlotPlus FORTRAN code (ppl subdirectory)
PPLUS_FFLAGS    = -g -zero -fPIC -noautomatic -c -assume no2underscores -assume nobscc -extend-source 132 -heap-arrays 10 -align dcommons -Dunix -DNEED_IAND -DFORTRAN_90 $(FINCLUDES)

# Flags for compiling non-PlotPlus FORTRAN code
FFLAGS          = -g -zero -fPIC -noautomatic -c -assume no2underscores -assume nobscc -extend-source 132 -heap-arrays 10 -align dcommons -Dunix -DNEED_IAND -DFORTRAN_90 $(FINCLUDES)

CPP		= /usr/bin/cpp-4.2
CPP_FLAGS       = $(INCLUDES) -P -Dunix -DFORTRAN_90 \
		  -DX_REFRESH -DNO_DOUBLE_ESCAPE_SLASH \
		  -Dxgks -DSTAR_1_SUPPORTED \
		  -DFULL_GUI_VERSION \
		  -DXT_CODE

OPT_FLAGS	= -O -DNDEBUG
PPLUS_OPT_FLAGS	= -O0
DBG_FLAGS	= -O0 -g
PROF_FLAGS	= -O0 -g

# Below this line are macro definitions used only for the final linking of the executable
#

LD		= gcc-4.2
LDFLAGS		= -v --verbose -fpic -arch x86_64 -L/usr/X11R6/lib 
LD_DYN_FLAGS	= -v -fpic -arch x86_64 -dynamiclib -L/usr/X11R6/lib -L$(TMAP_LOCAL)/lib -lefi
#LDFLAGS		= -v --verbose -L/lib -L/usr/X11R6/lib  -static 



SYSLIB		= -L/usr/X11R6/lib -L/usr/local/lib/ -L$(TMAP_LOCAL)/lib -ldl -lXpm -lXft -lXrender -lfontconfig -llist -lc /usr/local/lib/libXm.a -lXt -lXext -lX11 -lXp -lSM -lICE -lc /opt/intel/Compiler/11.1/058/lib/lib{ifcore,ifport,irc,imf,svml}.a

GKSLIB		= -L$(TMAP_LOCAL)/lib -lxgks

READLINELIB	= /usr/local/lib/libreadline.a -ltermcap

#HDFLIB		= -L/usr/local/lib  -ldf -ljpeg -lz
HDFLIB		= -L/usr/local/lib  -ldf /usr/local/lib/libjpeg.a -lz

CDFLIB		= -L/usr/local/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -lm /usr/local/lib/libsz.a -lnc-dap -ldap -ldapclient -lcurl -lxml2 -lpthread -licucore -lstdc++

DODS_LIBS   	= -L$(TMAP_LOCAL)/src/DODS/lib -L$(TMAP_LOCAL)/src/DODS/packages/lib $(TMAP_LOCAL)/src/DODS/lib/libnc-dods.a  $(TMAP_LOCAL)/src/DODS/lib/libnc-dods.a -lwww -lstdc++ -lrx -lz -lexpect5.21 -ltcl7.6

LINUX_OBJS  = dat/*.o ../fmt/src/x*.o ../ppl/plot/ppldata.o

#.F.o:
#	rm -f $*__.f
#	$(CPP) -traditional $(CPP_FLAGS) $(<F) | sed -e        's/de	/de /g' | sed -e  's/de 	/de /g' > $*__.f
#	$(F77) $(FFLAGS) $*__.f; mv $*__.o $*.o

# Directly compile the .F source files to the .o object files
# since gfortran can handle the C compiler directives in Fortran code
%.o : %.F
	$(FC) $(FFLAGS) -c $*.F -o $*.o

#
# End of platform_specific_flags.mk.x86_64-darwin
#
