VPATH += -I$(LIBEX1629_DIR)

CFLAGS += -I$(LIBEX1629_DIR)

CLIENT_OBJS = \
	dio.o \
	reg_iface.o \
	main.o \
	scanlist.o \
	config.o \
	trigger.o \
	conf.o \
	gain.o \
	excitation.o \
	filter.o \
	euconv.o \
	compres.o \
	inputmux.o \
	shunt.o \
	teds.o \
	fifo.o \
	getstream.o \
	decimation.o \
	exreset.o \
	version.o \
	serialnum.o \
	selfcal.o \
	selftest.o \
	profiling.o \
	timestamp.o \
	hdstream.o \
	cal.o \
	leds.o \
	corevolt.o \
	limits.o \
	leadwire.o \
	$(SHARED_DIR)/ex1629_errors.o

CLIENT_CMDS = \
	diosetbank0dir diogetbank0dir diosetbank1dir diogetbank1dir \
	diosetbank0outputtype diogetbank0outputtype diosetbank1outputtype diogetbank1outputtype \
	diosetoutput diogetoutput diogetinput diosendpulse \
	diosetoutputpolarity diogetoutputpolarity diosetinputpolarity diogetinputpolarity \
	diosetconfigevents diogetconfigevents diogetconfigeventsall dioclearevents diocleareventsall \
        diosetactioncontrol diogetactioncontrol\
	diosetfifo diogetfifo \
	setexcitationpos getexcitationpos setexcitationneg getexcitationneg \
	setinputmux getinputmux setcompres getcompres \
	setshunt getshunt setshuntenable getshuntenable \
	settedsdata gettedsdata erasetedsdata\
	setcalblocktedsdata getcalblocktedsdata \
	getmlantedsurn readmlanteds writemlanteds \
	setgain getgain \
	regsetcalsrc reggetcalsrc \
	regsetcalout reggetcalout \
	setscanlist \
	getscanlist \
	storecurrentconfig loadstoredconfig clearstoredconfig \
	getcurrentconfigdigest getstoredconfigdigest  \
	getcurrentconfig getstoredconfig storeconfig  \
	triginit \
	trigabort \
	trigreset \
	softtrig softarm softsync \
	setlxiconfig getlxiconfig \
	setlxiwiredor getlxiwiredor \
	getsystemtime getptpinfo \
	setlxioutput getlxioutput \
	getlxiinput sendlxipulse \
	setlxilimitevents getlxilimitevents setlxilimitlatches getlxilimitlatches \
	settriggerparam \
	settriggersrc \
	settriggerarmsrc \
	settriggersyncsrc \
	settriggerclksrc \
	gettriggerparam \
	gettriggersrc \
	gettriggerarmsrc \
	gettriggersyncsrc \
	gettriggerclksrc \
	setexcitationvolt \
	setexcitationenable \
	getexcitation \
	setfilter \
	getfilter \
	getsettlingtime \
	setsampfreq \
	getsampfreq \
	getcicdecimation \
	getselfcalconst \
	setselfcalconst \
	setconfscanlist getconfscanlist \
	getexcitecurrsupported \
	setconflimitreportingmode getconflimitreportingmode \
	setconflimit getconflimit \
	setbridgelimitenabled getbridgelimitenabled \
	setbridgelimit getbridgelimit \
	getconffilterwt setconffilterwt \
	gettriggertimestamp \
	getsynctimestamp setsynctimestamp \
	getconversion setconversion \
	getunstrainedvoltage setunstrainedvoltage \
	getgagefactor setgagefactor \
	getpoissonratio setpoissonratio \
	gettare settare \
	getconvunits setconvunits \
	getcalfile \
	setdspreg \
	getdspreg \
	readfifo \
	resetfifo \
	getstream \
	getnetdecimation setnetdecimation \
	exreset \
	getdspversion getbackplaneversion getdigitalversion \
	getfirmwareversion \
	getserialnum \
	measureexcitationvoltage \
	measureunstrainedvoltage \
	measureconf \
	selfcalinit selfcalstatus selfcalclear selfcalclearstored selfcalload selfcalstore selfcalisstored \
	factorycalstatus \
	geteuconvexcitation seteuconvexcitation \
	geteuconvexcitationvoltsrc seteuconvexcitationvoltsrc \
	selftestinit selfteststatus \
	setprofilingenabled setprofilingdisabled resetprofiling getprofiling \
	getleds setleds \
	getdmmtypes \
	hdstream \
	setcorevoltreg getcorevoltreg \
	measureleadwireresistance \
	getleadwireresistance   setleadwireresistance \
	sethalfbridgeleadwiredesensitization  gethalfbridgeleadwiredesensitization \
        setsensorled \
        zerocalinit

ALL_OBJS = $(CLIENT_OBJS)

# removed these from CLIENT_CMDS - the files can eventually be removed,too
# setwideband getwideband 

all:	client

# EX1629 auto-dependency generation
-include $(EX1629_ROOT)/AutoDep
-include $(ALL_OBJS:.o=.P)

client:	Makefile $(CLIENT_OBJS) $(LIBEX1629_LIB)
	$(CC) $(CFLAGS) $(LDFLAGS) $(CLIENT_OBJS) -o $@ $(LIBEX1629_LIB) $(LDLIBS)

clean:
	rm -f client
	rm -f TAGS tags
	rm -f *.o *.P

install:
ifndef CONFIG_USER_EX1629_BUILDING_RECOVERY
	cp client $(TARGET_FS_ROOT)/bin
	for i in $(CLIENT_CMDS) ; do \
		ln -sf client $(TARGET_FS_ROOT)/bin/$$i; \
	done
endif

.PHONY: tags
tags: $(CURDIR)/tags

.PHONY: TAGS
TAGS: $(CURDIR)/TAGS

$(CURDIR)/tags: *.[ch]
	ctags $^

$(CURDIR)/TAGS: *.[ch]
	etags $^
