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 | |
| 14 | ifeq ($(filter 'IPQ807x' 'IPQ60xx',$(PRODUCT_INFO_CHIPSET)),$(PRODUCT_INFO_CHIPSET)) |
| 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 |
| 34 | cp temp/*.ko build/bin; |
xiaofeis | b4ed35a | 2014-10-16 14:26:52 +0800 | [diff] [blame] | 35 | rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a |
Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 36 | @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished." |
| 37 | |
| 38 | kslib:kslib_o |
| 39 | $(AR) -r $(BIN_DIR)/$(KS_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/KSLIB/*.o) |
| 40 | |
| 41 | kslib_o: |
| 42 | $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=KSLIB -C src/$i all || exit 1;) |
| 43 | |
| 44 | uslib:uslib_o |
| 45 | $(AR) -r $(BIN_DIR)/$(US_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/USLIB/*.o) |
| 46 | |
| 47 | uslib_o: |
| 48 | $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=USLIB -C src/$i all || exit 1;) |
| 49 | |
| 50 | shell:uslib shell_o |
| 51 | $(CP) $(BLD_DIR)/SHELL/$(SHELLOBJ) $(BIN_DIR)/$(SHELLOBJ) |
| 52 | $(STRIP) $(BIN_DIR)/$(SHELLOBJ) |
| 53 | |
| 54 | shell_o: |
| 55 | $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=SHELL -C src/$i all || exit 1;) |
| 56 | |
| 57 | $(BIN_DIR): |
| 58 | $(MKDIR) -p $@ |
| 59 | |
Kyle Swenson | 845ea37 | 2021-01-26 14:07:57 -0700 | [diff] [blame] | 60 | install: |
| 61 | [ -d $(MODULEPATH) ] || \ |
| 62 | (mkdir -p $(MODULEPATH);chmod 755 $(MODULEPATH)) |
| 63 | cp -r build/bin/*.ko $(MODULEPATH) |
| 64 | |
Yue Lun | 03a82d9 | 2013-10-21 10:15:02 +0800 | [diff] [blame] | 65 | release: |
| 66 | @cd make; ./release.sh $(VER) |
| 67 | |
| 68 | clean: |
| 69 | $(RM) -f $(BLD_DIR)/KSLIB/* |
| 70 | $(RM) -f $(BLD_DIR)/USLIB/* |
| 71 | $(RM) -f $(BLD_DIR)/SHELL/* |
| 72 | $(RM) -f $(BIN_DIR)/* |
Kyle Swenson | 845ea37 | 2021-01-26 14:07:57 -0700 | [diff] [blame] | 73 | $(RM) -rf ./temp |