ifeq ($(v),1)
Q =
else
Q = @
endif

CC 	=	/opt/EmbedSky/TQT536/bin/aarch64-none-linux-gnu-gcc 

IFLAGS  = -idirafter dummyinc
CFLAGS	= -O0 -g -Wshadow -Wformat -Wall -W -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-pointer-sign 
# CFLAGS	= -O2 -Wshadow -Wformat -w -W -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-pointer-sign -Wno-date-time
CPUFLAGS = -mcpu=cortex-a55
#FPFLAGS = -mfdivdu -mfloat-abi=hard -mhard-float -mdouble-float


CFLAGS += -I$(FUXI_RT_LITE_PWD)/include
CFLAGS += -I$(FUXI_BSP_PWD)/include
CFLAGS += -I$(PRJ_PWD)/tmp/app_public/get_keyword
CFLAGS += -I$(PRJ_PWD)/tmp/app_public/gps
CFLAGS += -I$(PRJ_PWD)/tmp/app_public/xdljd
CFLAGS += -I$(PRJ_PWD)/tmp/app_public/sys_api
CFLAGS += -I$(PRJ_PWD)/app
CFLAGS += -I$(PRJ_PWD)
CFLAGS += $(GD_AREA)
CFLAGS += $(CPU_TYPE)
CFLAGS += $(MACHINE_TYPE)
CFLAGS += -D_GNU_SOURCE

LIBS = -lpthread -lm -lrt

OBJS =  main_mod.o \
		tmp/rt_lite/source/rt.o \
		tmp/rt_lite/source/rt_clib_snprintf.o \
		tmp/rt_lite/source/rt_console.o \
		tmp/rt_lite/source/rt_env.o \
		tmp/rt_lite/source/rt_error.o \
		tmp/rt_lite/source/rt_fifo.o \
		tmp/rt_lite/source/rt_file.o \
		tmp/rt_lite/source/rt_log.o \
		tmp/rt_lite/source/rt_printf.o \
		tmp/rt_lite/source/rt_socket.o \
		tmp/rt_lite/source/rt_stat.o \
		tmp/rt_lite/source/rt_clib.o \
		\
		tmp/fuxi_bsp/source/ad7616.o \
		tmp/fuxi_bsp/source/bsp.o \
		tmp/fuxi_bsp/source/dido.o \
		tmp/fuxi_bsp/source/gx21m15.o \
		tmp/fuxi_bsp/source/shm.o \
		tmp/fuxi_bsp/source/mb.o \
		tmp/fuxi_bsp/source/dspi.o \
		tmp/fuxi_bsp/source/e2prom_24lc.o \
		tmp/fuxi_bsp/source/e2prom_emu.o \
		tmp/fuxi_bsp/source/equ_ftu.o \
		tmp/fuxi_bsp/source/factor.o \
		tmp/fuxi_bsp/source/flash_at45db321.o \
		tmp/fuxi_bsp/source/freq.o \
		tmp/fuxi_bsp/source/gpio.o \
		tmp/fuxi_bsp/source/gps.o \
		tmp/fuxi_bsp/source/gps_1588.o \
		tmp/fuxi_bsp/source/i2c.o \
		tmp/fuxi_bsp/source/led_ftu.o \
		tmp/fuxi_bsp/source/pit.o \
		tmp/fuxi_bsp/source/pwm.o \
		tmp/fuxi_bsp/source/rtc_rx8025.o \
		tmp/fuxi_bsp/source/uart.o \
		tmp/fuxi_bsp/source/ustimer.o \
		tmp/fuxi_bsp/source/watchdog.o \
		tmp/fuxi_bsp/source/fourier.o \
		\
		tmp/app/history_db.o\
		tmp/app/app.o\
		tmp/app/Appconfig.o\
		tmp/app/ASCII.o\
		tmp/app/at_cmd.o\
		tmp/app/battery.o\
		tmp/app/channel.o\
		tmp/app/CommPowerModule.o\
		tmp/app/csv_rw.o\
		tmp/app/dcfactor.o\
		tmp/app/down_panel_prog.o\
		tmp/app/encrypt_core.o\
		tmp/app/equ.o\
		tmp/app/fft.o\
		tmp/app/floatspc.o\
		tmp/app/Fmt.o\
		tmp/app/func.o\
		tmp/app/gen.o\
		tmp/app/gprs_aux.o\
		tmp/app/gprs_proc.o\
		tmp/app/gprs_vs_func.o\
		tmp/app/history_file.o\
		tmp/app/history_rcd.o\
		tmp/app/IEC101.o\
		tmp/app/IEC101_FILE.o\
		tmp/app/IEC104.o\
		tmp/app/IECComm.o\
		tmp/app/IECLINK.o\
		tmp/app/Modbus.o\
		tmp/app/iectable.o\
		tmp/app/MmiData.o\
		tmp/app/LcdComm.o\
		tmp/app/led.o\
		tmp/app/main.o\
		tmp/app/Maintain.o\
		tmp/app/mea.o\
		tmp/app/Menu2c.o\
		tmp/app/MmiDrv.o\
		tmp/app/myconf.o\
		tmp/app/net_104.o\
		tmp/app/net_debug.o\
		tmp/app/net_104link.o\
		tmp/app/net_maintain.o\
		tmp/app/oc.o\
	  	tmp/app/fsx.o\
		tmp/app/offtime.o\
		tmp/app/pda.o\
		tmp/app/PDA_FILE.o\
		tmp/app/plc.o\
		tmp/app/protect.o\
		tmp/app/protocol.o\
		tmp/app/ptl_pwrm.o\
		tmp/app/reclose.o\
		tmp/app/record.o\
		tmp/app/run_status.o\
		tmp/app/samint.o\
		tmp/app/sc1161y.o\
		tmp/app/serial_stat.o\
		tmp/app/set.o\
		tmp/app/SM2.o\
		tmp/app/sm2_dev.o\
		tmp/app/sntp.o\
		tmp/app/SOE.o\
		tmp/app/switch.o\
		tmp/app/sxyb.o\
		tmp/app/Sys.o\
		tmp/app/sysTime.o\
		tmp/app/timer.o\
		tmp/app/uart_comm.o\
		tmp/app/UnitsLib.o\
		tmp/app/vol.o\
		tmp/app/FA.o\
		tmp/app/bzt.o\
		tmp/app/x509.o\
		tmp/app/FA_g.o\
		tmp/app/modify.o\
		tmp/app/xdljd.o\
		tmp/app/auth.o\
		tmp/app/lib61850.o\
		tmp/app/read_id.o\
		tmp/app/base64.o\
		tmp/app/shm_comm_packet.o\
		tmp/app/printf_e907.o\
		tmp/app/fuxi_shm_app.o\
		\
		tmp/app_public/xdljd/jdxx.o\
		tmp/app_public/get_keyword/get_keyword.o \
		tmp/app_public/gps/gps_uart.o \
		tmp/app_public/sys_api/sys_api.o\

#		tmp/lib61850.o\

all:$(app_name)

%.o:%.c
	@echo -e "  CC   $<"
	$(Q)$(CC) -c $< $(CFLAGS) $(IFLAGS) $(CPUFLAGS) $(FPFLAGS) -o $@

$(app_name): $(OBJS)
	@echo -e "  CC   $@"
	$(Q)$(CC) -o $(app_name) $(OBJS) $(LINK) $(LIBS) $(LDFLAGS) $(CPUFLAGS) $(FPFLAGS)

# %.o:%.c
# 	@echo -e "  CC   $<"
# 	@$(CC) -c $< $(CFLAGS) $(IFLAGS) $(CPUFLAGS) $(FPFLAGS) -o $@


# $(app_name): $(OBJS)
# 	@echo -e "  CC   $@"
# 	@$(CC) -o $(app_name) $(OBJS) $(LINK) $(LIBS) $(LDFLAGS) $(CPUFLAGS) $(FPFLAGS)

	
clean:
	rm -rf tmp/ *.o *.swp ko/*

