# +++ changed by Celeno: PLATFORM and CROSS_COMPILE should be passed from celeno.config/celeno.mk
# Include this file that contains definitions.
ifeq ($(PLATFORM),PUMA5) 
-include $(TARGET_HOME)/TI_Build.make
build_filesystem_path=$(TI_filesystem_path)
endif

ifeq ($(CROSS_COMPILE),)
ifneq ($(PLATFORM),PC)
ifneq ($(PLATFORM),SBC)
$(error CROSS_COMPILE not defined for platform different from PC/SBC)
endif
endif
endif

#PLATFORM = 5VT
#PLATFORM = PC
#PLATFORM = STAR
#PLATFORM = RT2880

# ifeq ($(PLATFORM),RT2880)
# CROSS_COMPILE = mipsel-linux-
# endif
#
# ifeq ($(PLATFORM),5VT)
# CROSS_COMPILE = /opt/crosstool/uClibc_v5te_le_gcc_4_1_1/bin/arm-linux-
# endif
#
# ifeq ($(PLATFORM),STAR)
# CROSS_COMPILE = /opt/star/tools/arm-linux/bin/arm-linux-
# endif
#
# ifeq ($(PLATFORM),PC)
# CROSS_COMPILE =
# endif

# --- changed by Celeno


CC = $(CROSS_COMPILE)gcc

ifndef CFLAGS
CFLAGS = -O2 -Wall -g
endif

# If you want to support multiple radius server for multiple bssid, add following line
CFLAGS +=  -DMULTIPLE_RADIUS

# If you want to debug daemon, add following line
CFLAGS +=  -DDBG 

# CELENO added
CFLAGS += -DCELENO -Werror

# Dual concurrent
ifeq ($(CONFIG_CONCURRENT_INIC_SUPPORT), y)
CFLAGS += -DCONFIG_CONCURRENT_INIC_SUPPORT
endif

OBJS =	rt2860apd.o eloop.o eapol_sm.o radius.o md5.o  \
	config.o ieee802_1x.o  \
	sta_info.o   radius_client.o

all: build install

build: $(OBJS)
	$(CC) -o rtdot1xd $(OBJS)
	cp rtdot1xd rt2860apd

install:
	@echo "rtdot1xd: install"
	@if [ -x /usr/bin/sudo ]; then sudo mkdir -p -m 777 $(build_inic_install_dir); else mkdir -p -m 777 $(build_inic_install_dir);fi;
	install -m 0755 rtdot1xd $(build_filesystem_path)/etc/Wireless/CL1800

clean:
	rm -f core *~ *.o rtdot1xd rt2860apd *.d

#
# add by YYHuang@Ralink
romfs:
	$(ROMFSINST) rt2860apd /bin/rt2860apd
	ln -sf rt2860apd $(ROMFSDIR)/bin/rtinicapd

-include $(OBJS:%.o=%.d)
