92 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
		
		
			
		
	
	
			92 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
|  | 
 | ||
|  | # OUTPUT type
 | ||
|  | # 1 - .out
 | ||
|  | # 2 - .a
 | ||
|  | # 3 - .so
 | ||
|  | OUTPUT_TYPE	= 2 | ||
|  | OUTPUT_NAME	= driver | ||
|  | 
 | ||
|  | PRE_MARCO  += | ||
|  | 
 | ||
|  | ifeq ($(target), kunlun2) | ||
|  | hw_dep = hw2 | ||
|  | else | ||
|  |    ifeq ($(target), kunlun3) | ||
|  |    hw_dep = hw3 | ||
|  |    else | ||
|  |    hw_dep = hw | ||
|  |    endif | ||
|  | endif | ||
|  | 
 | ||
|  | SUB_DIRS    = src/hal | ||
|  | SUB_DIRS    += src/$(hw_dep) | ||
|  | 
 | ||
|  | ifeq ($(target), kunlun2) | ||
|  | SUB_DIRS   += src/$(hw_dep)/cnn | ||
|  | SUB_DIRS   += src/$(hw_dep)/dnn | ||
|  | endif | ||
|  | 
 | ||
|  | ifeq ($(target), kunlun3) | ||
|  | SUB_DIRS    += src/$(hw_dep)/mbedtls | ||
|  | endif | ||
|  | 
 | ||
|  | SUB_DIRS   += extern/em/src extern/htm/src extern/rtc/src extern/gsm/src \
 | ||
|  |             extern/wk2xxx_uart/src extern/ext-io/src extern/bluetooth/src \
 | ||
|  |             extern/virtualchannel/vc_upgrade extern/virtualchannel/src | ||
|  | 
 | ||
|  | ifeq ($(smp_enable), 1) | ||
|  | FREERTOS = freertos_smp | ||
|  | ADD_INCLUDE +=$(TOPDIR)/os/$(FREERTOS)/src/portable/RISCV | ||
|  | else | ||
|  | FREERTOS = freertos | ||
|  | endif | ||
|  | 
 | ||
|  | ADD_INCLUDE += $(TOPDIR)/driver/src/$(hw_dep)/inc $(TOPDIR)/driver/src/$(hw_dep)/inc/cnn | ||
|  | ADD_INCLUDE += inc $(TOPDIR)/inc $(TOPDIR)/inc/compiler/gcc  $(TOPDIR)/common/io_lib/inc \
 | ||
|  |             $(TOPDIR)/inc/compiler/gcc $(TOPDIR)/inc/driver $(TOPDIR)/inc/driver/flash \
 | ||
|  |             $(TOPDIR)/inc/io_lib $(TOPDIR)/inc/os_shim $(TOPDIR)/inc/pib $(TOPDIR)/inc/pkt \
 | ||
|  |             $(TOPDIR)/inc/utils $(TOPDIR)/inc/uart $(TOPDIR)/os/$(FREERTOS)/src/include \
 | ||
|  |             $(TOPDIR)/plc/inc $(TOPDIR)/inc/dbglog $(TOPDIR)/export/inc $(TOPDIR)/driver/inc \
 | ||
|  |             $(TOPDIR)/export/inc/gpio $(TOPDIR)/plc/halmac/inc $(TOPDIR)/plc/halmac/hw/inc \
 | ||
|  |             $(TOPDIR)/inc/crypto $(TOPDIR)/plc/halphy/$(hw_dep)/inc $(TOPDIR)/plc/halphy/inc \
 | ||
|  |             $(TOPDIR)/ftm/inc $(TOPDIR)/plc/halmac/$(hw_dep)/inc/desc $(TOPDIR)/driver/inc \
 | ||
|  |             $(TOPDIR)/inc/plc_lib $(TOPDIR)/inc/lzma | ||
|  | ADD_INCLUDE += $(TOPDIR)/driver/extern/em/inc $(TOPDIR)/driver/extern/htm/inc $(TOPDIR)/driver/extern/rtc/inc \
 | ||
|  |             $(TOPDIR)/driver/extern/gsm/inc $(TOPDIR)/driver/extern/wk2xxx_uart/inc \
 | ||
|  |             $(TOPDIR)/driver/extern/bluetooth/inc $(TOPDIR)/driver/extern/virtualchannel/inc \
 | ||
|  |             $(TOPDIR)/driver/extern/ext-io/inc $(TOPDIR)/export/inc/utils | ||
|  | ADD_INCLUDE += $(TOPDIR)/inc/cli $(TOPDIR)/cli/communicator | ||
|  | ADD_INCLUDE += $(TOPDIR)/driver/inc/mbedtls | ||
|  | 
 | ||
|  | ifeq ($(target), kunlun3) | ||
|  | ADD_INCLUDE += $(TOPDIR)/plc/halmac/$(hw_dep)/plc_inc/desc $(TOPDIR)/plc/halmac/$(hw_dep)/plc_inc $(TOPDIR)/rom/riscv3/romlib/crypto/mbedtls-2.4.0/include $(TOPDIR)/rom/riscv3/romlib/crypto/iotelic/inc/mbedtls | ||
|  | endif | ||
|  | 
 | ||
|  | ifeq ($(gcc), arm) | ||
|  | ADD_INCLUDE += $(TOPDIR)/os/freertos/src/portable/ARM_CM3 | ||
|  | else | ||
|  | ADD_INCLUDE += $(TOPDIR)/os/$(FREERTOS)/src/portable/RISCV | ||
|  | ADD_INCLUDE += $(TOPDIR)/startup/riscv/inc | ||
|  | endif | ||
|  | 
 | ||
|  | # lib need to ld together
 | ||
|  | ADD_LIB		= | ||
|  | 
 | ||
|  | ifdef TOPDIR | ||
|  | include $(TOPDIR)/build/makefile.cfg | ||
|  | else | ||
|  | include $(CURDIR)/build/makefile.cfg | ||
|  | TOPDIR		= $(CURDIR) | ||
|  | export TOPDIR | ||
|  | endif | ||
|  | 
 | ||
|  | # display the obj files and output name
 | ||
|  | debug: | ||
|  | 	@echo TOPDIR=$(TOPDIR) | ||
|  | 	@echo OUTPUT_LIB=$(OUTPUT_FULL_NAME) | ||
|  | 	@echo DEPS=$(DEPS) | ||
|  | 	@echo OBJECTS=$(OBJECTS) | ||
|  | 	@echo SRCS=$(SRCS) | ||
|  | 	@echo OBJECTS folder=$(foreach dirname, $(SUB_DIRS), $(addprefix $(BIN_DIR)/, $(dirname))) | ||
|  | 	@echo output_name=$(OUTPUT_FULL_NAME) |