Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 1 | include ./config |
| 2 | |
| 3 | ifndef PRJ_PATH |
| 4 | PRJ_PATH=$(shell pwd) |
| 5 | endif |
| 6 | export PRJ_PATH |
| 7 | |
| 8 | include ./make/config.mk |
| 9 | include ./make/tools.mk |
| 10 | include ./make/$(OS)_opt.mk |
| 11 | |
Kyle Swenson | 845ea37 | 2021-01-26 14:07:57 -0700 | [diff] [blame] | 12 | MODULEPATH := $(DESTDIR)/lib/modules/$(KVER)-coconut/extra |
| 13 | |
Kyle Swenson | 1bf26a0 | 2022-06-08 08:13:51 -0600 | [diff] [blame^] | 14 | ifeq ($(filter 'IPQ807x' 'IPQ60xx' 'IPQ50xx',$(PRODUCT_INFO_CHIPSET)),$(PRODUCT_INFO_CHIPSET)) |
Kyle Swenson | 845ea37 | 2021-01-26 14:07:57 -0700 | [diff] [blame] | 15 | SUB_DIR=src/adpt src/ref src/sal src/api src/util src/fal src/hsl src/shell_lib src/init |
| 16 | CFLAGS += -DQCA_SSDK_SWCONFIG |
| 17 | ifneq ($(filter yes, $(PRODUCT_FEATURE_SFP)),) |
| 18 | CFLAGS += -DSFP_GPIO_DETECT |
| 19 | endif |
| 20 | ifneq ($(filter IRONMAN CMARVEL, $(PRODUCT)),) |
| 21 | SUB_DIR += src/cp |
| 22 | CFLAGS += -DCP_MULTI_SWITCH |
| 23 | CFLAGS += -DCP_MULTI_SWITCH_$(PRODUCT) |
| 24 | endif |
| 25 | else |
Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 26 | SUB_DIR=$(patsubst %/, %, $(dir $(wildcard src/*/Makefile))) |
Kyle Swenson | 845ea37 | 2021-01-26 14:07:57 -0700 | [diff] [blame] | 27 | endif |
| 28 | |
Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 29 | SUB_LIB=$(subst src/, , $(SUB_DIR)) |
| 30 | |
Zou Shunxiang | 4c786c9 | 2014-01-21 16:02:33 +0800 | [diff] [blame] | 31 | all: $(BIN_DIR) kslib |
Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 32 | mkdir -p ./temp/;cd ./temp;cp ../build/bin/ssdk_ks_km.a ./;ar -x ssdk_ks_km.a; cp ../ko_Makefile ./Makefile; |
Yue Lun | 6405656 | 2013-10-30 18:02:43 +0800 | [diff] [blame] | 33 | make -C $(SYS_PATH) M=$(PRJ_PATH)/temp/ CROSS_COMPILE=$(TOOLPREFIX) modules |
Kyle Swenson | 044f5ff | 2021-03-16 14:38:27 -0600 | [diff] [blame] | 34 | cp $(PRJ_PATH)/temp/Module.symvers $(PRJ_PATH)/Module.symvers; |
Yue Lun | 6405656 | 2013-10-30 18:02:43 +0800 | [diff] [blame] | 35 | cp temp/*.ko build/bin; |
xiaofeis | b4ed35a | 2014-10-16 14:26:52 +0800 | [diff] [blame] | 36 | rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a |
Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 37 | @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." |
| 38 | |
| 39 | kslib:kslib_o |
| 40 | $(AR) -r $(BIN_DIR)/$(KS_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/KSLIB/*.o) |
| 41 | |
| 42 | kslib_o: |
| 43 | $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=KSLIB -C src/$i all || exit 1;) |
| 44 | |
| 45 | uslib:uslib_o |
| 46 | $(AR) -r $(BIN_DIR)/$(US_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/USLIB/*.o) |
| 47 | |
| 48 | uslib_o: |
| 49 | $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=USLIB -C src/$i all || exit 1;) |
| 50 | |
| 51 | shell:uslib shell_o |
| 52 | $(CP) $(BLD_DIR)/SHELL/$(SHELLOBJ) $(BIN_DIR)/$(SHELLOBJ) |
| 53 | $(STRIP) $(BIN_DIR)/$(SHELLOBJ) |
| 54 | |
| 55 | shell_o: |
| 56 | $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=SHELL -C src/$i all || exit 1;) |
| 57 | |
| 58 | $(BIN_DIR): |
| 59 | $(MKDIR) -p $@ |
| 60 | |
Kyle Swenson | 845ea37 | 2021-01-26 14:07:57 -0700 | [diff] [blame] | 61 | install: |
| 62 | [ -d $(MODULEPATH) ] || \ |
| 63 | (mkdir -p $(MODULEPATH);chmod 755 $(MODULEPATH)) |
| 64 | cp -r build/bin/*.ko $(MODULEPATH) |
| 65 | |
Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 66 | release: |
| 67 | @cd make; ./release.sh $(VER) |
| 68 | |
| 69 | clean: |
| 70 | $(RM) -f $(BLD_DIR)/KSLIB/* |
| 71 | $(RM) -f $(BLD_DIR)/USLIB/* |
| 72 | $(RM) -f $(BLD_DIR)/SHELL/* |
| 73 | $(RM) -f $(BIN_DIR)/* |
Kyle Swenson | 845ea37 | 2021-01-26 14:07:57 -0700 | [diff] [blame] | 74 | $(RM) -rf ./temp |