# Set the variable below to a suitable eCos build.

#INSTALL_DIR := <some path>

ifeq (,$(INSTALL_DIR))
$(error Please edit this makefile to set INSTALL_DIR)
else
 ifeq (,$(wildcard $(INSTALL_DIR)/include/pkgconf/ecos.mak))
  $(error Directory $(INSTALL_DIR) does not contain an eCos build.)
 endif
endif

# Pick up appropriate makefile settings from the eCos build.
include $(INSTALL_DIR)/include/pkgconf/ecos.mak

default: sertest

sertest: sertest.c xyzModem.c
	$(ECOS_COMMAND_PREFIX)gcc -o $@ $(ECOS_GLOBAL_CFLAGS) $(ECOS_GLOBAL_LDFLAGS) \
	-I$(INSTALL_DIR)/include -L$(INSTALL_DIR)/lib -Ttarget.ld $^
	cp $@ $@.strip
	$(ECOS_COMMAND_PREFIX)strip $@.strip

nettest: nettest.c
	$(ECOS_COMMAND_PREFIX)gcc -o $@ $(ECOS_GLOBAL_CFLAGS) $(ECOS_GLOBAL_LDFLAGS) \
	-I$(INSTALL_DIR)/include -L$(INSTALL_DIR)/lib -Ttarget.ld $<
	cp $@ $@.strip
	$(ECOS_COMMAND_PREFIX)strip $@.strip

transact: transact.c
	$(ECOS_COMMAND_PREFIX)gcc -o $@ $(ECOS_GLOBAL_CFLAGS) $(ECOS_GLOBAL_LDFLAGS) \
	-I$(INSTALL_DIR)/include -L$(INSTALL_DIR)/lib -Ttarget.ld $<

.PHONY: clean

clean:
	rm -f sertest sertest.strip nettest nettest.strip transact
