ifneq ($(WIND_PLATFORM), vxworks-6.6)

#CC	:= arm-softfloat-linux-gnu-gcc
#FSROOT	:= /home/nfs/fsminimal-debian_sarge-0.16

# it's possible to set up headers, libs and destination bin
# locations via FSROOT or PREFIX, difference is that to PREFIX we append
# include, lib and bin target dirs only, to FSROOT we append
# usr/local/include, usr/local/lib and usr/local/bin (bacward-compatible
# approach)

ifeq ($(PREFIX)$(FSROOT),) 
	# if nothing is set use /usr/local/ - backward compatibility             
	PREFIX := /usr/local/
endif

ifneq ($(FSROOT),)
	# fake PREFIX by appending usr/local
	PREFIX := $(FSROOT)/usr/local
endif

CFLAGS	+= -Wall -O2
CPPFLAGS+= -I $(PREFIX)/include
LDFLAGS	+= -L $(PREFIX)/lib -lvapi -lpthread -lgtlcommon -lgtlcsme -llegerity

TARGETS	:= vapi_demo
OBJS_DEMO := demo_main.o demo_utility.o readcfg.o

all: check_cc $(TARGETS)

check_cc:
	@echo $(CC) | grep -q arm || {						\
		echo This application must be cross-compiled for the ARM ;	\
		false ;								\
	}

clean:
	rm -f *.o *~ $(TARGETS)

install: $(TARGETS)
	mkdir -p $(PREFIX)/bin $(PREFIX)/etc
	cp $(TARGETS) $(PREFIX)/bin
#backup of the current config file first
	-cp $(PREFIX)/etc/demo.conf $(PREFIX)/etc/demo.conf.bak
	cp demo.conf $(PREFIX)/etc
	cp start_demo conf.dump conf.set $(PREFIX)/bin

vapi_demo: $(OBJS_DEMO)
	$(CC) $^ $(LDFLAGS) -o $@

.NOTPARALLEL: check_cc

else

include Makefile.vxworks-6.6

endif
