#----------------------------------------------------------------------------
# Makefile for SICS
#
# Mark Koennecke 1996-2001
#   Markus Zolliker March 2000: add tecs
#---------------------------------------------------------------------------


#------- comment or uncomment this if a fortified version is required.
# Note: A -DFORTIFY needs to be added to the CFLAGS as well.
#
#FORTIFYOBJ = fortify.o strdup.o
#----
FORTIFYOBJ = 
#---------------------------------------------------------------------------


#----- comment or uncomment if a difrac version is required
# Do not forget to remove or add comments to ofac.c as well if changes
# were made here.
 
DIFOBJ=
DIFIL=
#DIFOBJ=difrac.o  -Ldifrac -ldif -lfor
#---- 
#DIFOBJ=difrac.o  -Ldifrac -ldif 
#DIFIL= difrac.o
#---------------------------------------------------------------------------


COBJ = Sclient.o network.o ifile.o   intcli.o $(FORTIFYOBJ)  
SOBJ =  network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
       servlog.o sicvar.o nserver.o SICSmain.o \
       sicsexit.o  costa.o task.o $(FORTIFYOBJ)\
       macro.o ofac.o obpar.o obdes.o drive.o status.o intserv.o \
       devexec.o mumo.o mumoconf.o selector.o selvar.o fupa.o lld.o \
       lld_blob.o buffer.o strrepl.o ruli.o lin2ang.o fomerge.o\
       script.o o2t.o  alias.o napi45.o nxdata.o stringdict.o sdynar.o\
       histmem.o histdriv.o histsim.o sinqhmdriv.o interface.o callback.o \
        event.o emon.o evcontroller.o evdriver.o simev.o perfmon.o \
       danu.o itc4driv.o itc4.o nxdict.o nxsans.o varlog.o stptok.o nread.o \
       dilludriv.o scan.o fitcenter.o telnet.o token.o scontroller.o serial.o \
       tclev.o hkl.o integrate.o optimise.o dynstring.o nextrics.o nxutil.o \
       mesure.o uubuffer.o serialwait.o commandlog.o sps.o udpquieck.o \
       sanswave.o faverage.o bruker.o rmtrail.o fowrite.o ltc11.o \
       simchop.o choco.o chadapter.o docho.o trim.o eurodriv.o scaldate.o \
       hklscan.o xytable.o amor2t.o nxamor.o amorscan.o amorstat.o \
       circular.o el755driv.o maximize.o sicscron.o tecsdriv.o sanscook.o \
       tasinit.o tasutil.o t_rlp.o t_conv.o d_sign.o d_mod.o \
       tasdrive.o tasscan.o synchronize.o definealias.o swmotor.o t_update.o \
       hmcontrol.o userscan.o slsmagnet.o rs232controller.o lomax.o \
       polterwrite.o fourlib.o motreg.o motreglist.o anticollider.o \
       s_rnge.o sig_die.o
 
MOTOROBJ = motor.o el734driv.o simdriv.o el734dc.o pipiezo.o pimotor.o
COUNTEROBJ =  countdriv.o simcter.o counter.o
DMCOBJ     =  dmc.o
VELOOBJ    = velo.o velosim.o velodorn.o velodornier.o

.SUFFIXES:
.SUFFIXES: .tcl .htm .c .o

#----- comment or uncomment the following according to operating system

#------------- for Digital Unix
BINTARGET = bin
HDFROOT=/data/lnslib
CC=cc
EXTRA=
CFLAGS = -I$(HDFROOT)/include -Ihardsup -DHDF4 -DHDF5  -I. -std1 \
  -g -warnprotos -c
#CFLAGS = -I$(HDFROOT)/include -DFORTIFY -DHDF4 -DHDF5 -Ihardsup  -g \
#             -std1 -warnprotos -c
LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \
       -ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a  \
       $(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \
       $(HDFROOT)/lib/libjpeg.a -lz  -lm -ll -lc 

#------- for cygnus
#HDFROOT=../HDF411 
#CC=gcc
#EXTRA=
#CFLAGS = -I$(HDFROOT)/include -Ihardsup -DFORTIFY -DCYGNUS  -g -c
#LIBS= -L$(HDFROOT)/lib  -Lhardsup -lhlib -ltcl80 \
#    -lmfhdf -ldf -ljpeg -lz -lm  

#---------- for linux
#BINTARGET=../bin
#HDFROOT=/usr/local
#CC=gcc
#CFLAGS = -I$(HDFROOT)/include -DHDF4 -Ihardsup -fwritable-strings \
#  -DCYGNUS -DNONINTF -g -c
#CFLAGS = -I$(HDFROOT)/include -Ihardsup -fwritable-strings -DFORTIFY \
# -DCYGNUS -DNONINTF  -g -c
#LIBS= -L$(HDFROOT)/lib  -Lhardsup  -Ltecs -ltecsl -Lmatrix -lmatrix -lhlib \
#       -ltcl8.0 -lmfhdf -ldf -ljpeg -lz -lm  -lg2c -ldl
#EXTRA=nintf.o
#---------------------------------

.c.o:
	$(CC) $(CFLAGS) $*.c

all:    $(BINTARGET)/SICServer 

$(BINTARGET)/SICServer: $(SOBJ) $(MOTOROBJ) \
                        $(COUNTEROBJ) $(DMCOBJ) $(VELOOBJ) $(DIFIL) \
                        $(EXTRA) tecs/libtecsl.a hardsup/libhlib.a \
                        matrix/libmatrix.a
	$(CC) -g  -o SICServer \
	         $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) $(DMCOBJ) \
        	 $(VELOOBJ) $(DIFOBJ) $(EXTRA) $(LIBS)
	cp SICServer $(BINTARGET)		 

clean:
	- rm -f *.o
	- rm -f $(BINTARGET)/SICServer

Dbg.o:  Dbg.c
	cc -g  -I/data/koenneck/include -c Dbg.c
Dbg_cmd.o:  Dbg_cmd.c


