# VTI Instruments, Inc. (Ametek Instruments)
# Copyright 2014
# Nick Barendt
#
# Makefile to build the client apps for the EX1048

# general compilation and linker variables
EX1048_SRC_DIR = $(strip $(shell pwd))

ifeq ($(CONFIG_EXPRODUCT_TYPE),EX1048A)
    CFLAGS += -DCONFIG_USER_EX1048A_ENABLED
else
ifeq ($(CONFIG_EXPRODUCT_TYPE),RX1000)
    CFLAGS += -DCONFIG_USER_RX1000_ENABLED
else
ifeq ($(CONFIG_EXPRODUCT_TYPE),EX1000A51C)
    CFLAGS += -DCONFIG_USER_EX1000A51C_ENABLED
else
ifeq ($(CONFIG_EXPRODUCT_TYPE),EX1044)
    CFLAGS += -DCONFIG_USER_EX1000A51C_ENABLED
else
$(error Product type is not defined. Use environment varibale "CONFIG_EXPRODUCT_TYPE" to set.)
endif
endif
endif
endif

export CFLAGS += -Wall -O3 -I/$(SHARED_DIR) 
export SHARED_DIR = $(EX1048_SRC_DIR)/shared
export SCPILIB_DIR = $(EX1048_SRC_DIR)/scpilib
export EX1048_LINUX_CLIENT = 1

# update VPATH so make can find everything it needs
export VPATH += $(SHARED_DIR)

ex1048_sub_dir  = shared scpilib client

all:	
	for i in $(ex1048_sub_dir)  ; do \
		[ ! -d $$i ] || make -C $$i || exit $? ; \
	done

clean:
	for i in $(sort $(ex1048_sub_dir)) ; do \
		[ ! -d $$i ] || make -C $$i clean; \
	done
