blob: e8fca7078d554b7cf996dc4319681e818ca8aeda [file] [log] [blame]
Yue Lun03a82d92013-10-21 10:15:02 +08001include ./config
2
3ifndef PRJ_PATH
4 PRJ_PATH=$(shell pwd)
5endif
6export PRJ_PATH
7
8include ./make/config.mk
9include ./make/tools.mk
10include ./make/$(OS)_opt.mk
11
Kyle Swenson845ea372021-01-26 14:07:57 -070012MODULEPATH := $(DESTDIR)/lib/modules/$(KVER)-coconut/extra
13
14ifeq ($(filter 'IPQ807x' 'IPQ60xx',$(PRODUCT_INFO_CHIPSET)),$(PRODUCT_INFO_CHIPSET))
15SUB_DIR=src/adpt src/ref src/sal src/api src/util src/fal src/hsl src/shell_lib src/init
16CFLAGS += -DQCA_SSDK_SWCONFIG
17ifneq ($(filter yes, $(PRODUCT_FEATURE_SFP)),)
18CFLAGS += -DSFP_GPIO_DETECT
19endif
20ifneq ($(filter IRONMAN CMARVEL, $(PRODUCT)),)
21SUB_DIR += src/cp
22CFLAGS += -DCP_MULTI_SWITCH
23CFLAGS += -DCP_MULTI_SWITCH_$(PRODUCT)
24endif
25else
Yue Lun03a82d92013-10-21 10:15:02 +080026SUB_DIR=$(patsubst %/, %, $(dir $(wildcard src/*/Makefile)))
Kyle Swenson845ea372021-01-26 14:07:57 -070027endif
28
Yue Lun03a82d92013-10-21 10:15:02 +080029SUB_LIB=$(subst src/, , $(SUB_DIR))
30
Zou Shunxiang4c786c92014-01-21 16:02:33 +080031all: $(BIN_DIR) kslib
Yue Lun03a82d92013-10-21 10:15:02 +080032 mkdir -p ./temp/;cd ./temp;cp ../build/bin/ssdk_ks_km.a ./;ar -x ssdk_ks_km.a; cp ../ko_Makefile ./Makefile;
Yue Lun64056562013-10-30 18:02:43 +080033 make -C $(SYS_PATH) M=$(PRJ_PATH)/temp/ CROSS_COMPILE=$(TOOLPREFIX) modules
34 cp temp/*.ko build/bin;
xiaofeisb4ed35a2014-10-16 14:26:52 +080035 rm -Rf ./temp/*.o ./temp/*.ko ./temp/*.a
Yue Lun03a82d92013-10-21 10:15:02 +080036 @echo "---Build [SSDK-$(VERSION)] at $(BUILD_DATE) finished."
37
38kslib:kslib_o
39 $(AR) -r $(BIN_DIR)/$(KS_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/KSLIB/*.o)
40
41kslib_o:
42 $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=KSLIB -C src/$i all || exit 1;)
43
44uslib:uslib_o
45 $(AR) -r $(BIN_DIR)/$(US_MOD)_$(RUNMODE).a $(wildcard $(BLD_DIR)/USLIB/*.o)
46
47uslib_o:
48 $(foreach i, $(SUB_LIB), $(MAKE) MODULE_TYPE=USLIB -C src/$i all || exit 1;)
49
50shell:uslib shell_o
51 $(CP) $(BLD_DIR)/SHELL/$(SHELLOBJ) $(BIN_DIR)/$(SHELLOBJ)
52 $(STRIP) $(BIN_DIR)/$(SHELLOBJ)
53
54shell_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 Swenson845ea372021-01-26 14:07:57 -070060install:
61 [ -d $(MODULEPATH) ] || \
62 (mkdir -p $(MODULEPATH);chmod 755 $(MODULEPATH))
63 cp -r build/bin/*.ko $(MODULEPATH)
64
Yue Lun03a82d92013-10-21 10:15:02 +080065release:
66 @cd make; ./release.sh $(VER)
67
68clean:
69 $(RM) -f $(BLD_DIR)/KSLIB/*
70 $(RM) -f $(BLD_DIR)/USLIB/*
71 $(RM) -f $(BLD_DIR)/SHELL/*
72 $(RM) -f $(BIN_DIR)/*
Kyle Swenson845ea372021-01-26 14:07:57 -070073 $(RM) -rf ./temp