Kyle Swenson | 74ad753 | 2023-02-16 11:05:29 -0700 | [diff] [blame] | 1 | # Makefile for cpmodem_shim net_device hooks. |
| 2 | |
| 3 | ROOT ?= $(abspath ../../..) |
| 4 | include $(ROOT)/Makefile.config |
| 5 | |
| 6 | VERBOSITY := $(if $(filter $(MAKEVERBOSE),yes),1,0) |
| 7 | EXTRA_CFLAGS := -I$(CURDIR)/include |
| 8 | |
| 9 | #uncomment for debugging |
| 10 | #EXTRA_CFLAGS += -O0 |
| 11 | #EXTRA_CFLAGS += -g |
| 12 | |
| 13 | unexport CC CPP LD CFLAGS CPPFLAGS LDFLAGS AR RANLIB |
| 14 | |
| 15 | # grab the chipset, platform and memory defines from CPDEFINES. PRODUCT_INFO_CHIPSET can be in two forms (an int or a python invalid string): |
| 16 | # -DPRODUCT_INFO_CHIPSET=1234 or -DPRODUCT_INFO_CHIPSET='1234' |
| 17 | # PRODUCT_INFO_MEMORY is always an int so can use directly |
| 18 | # PRODUCT_PLATFORM is a symbol so needs double quotes added to turn it into a string |
| 19 | # The first patsubst removes the single quotes, the second one puts double quotes so the code can treat the define as a C string always. |
| 20 | CPNEWDEFINES := $(filter -DPRODUCT_INFO_CHIPSET=% -DPRODUCT_INFO_MEMORY=% -DPRODUCT_PLATFORM=%, $(CPDEFINES)) |
| 21 | CPNEWDEFINES := $(patsubst -DPRODUCT_INFO_CHIPSET='%', -DPRODUCT_INFO_CHIPSET=%, $(CPNEWDEFINES)) |
| 22 | CPNEWDEFINES := $(patsubst -DPRODUCT_INFO_CHIPSET=%, -DPRODUCT_INFO_CHIPSET=\\\"%\\\", $(CPNEWDEFINES)) |
| 23 | CPNEWDEFINES := $(patsubst -DPRODUCT_PLATFORM=%, -DPRODUCT_PLATFORM=\\\"%\\\", $(CPNEWDEFINES)) |
| 24 | EXTRA_CFLAGS += $(CPNEWDEFINES) |
| 25 | |
| 26 | default: install |
| 27 | |
| 28 | all: |
| 29 | $(MAKE) -C $(CPKERN) V=$(VERBOSITY) M=$(CURDIR) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" |
| 30 | |
| 31 | install: all |
| 32 | $(MAKE) -C $(CPKERN) M=$(CURDIR) INSTALL_MOD_PATH=$(ROOT)/$(IMGDIR)/rootfs ARCH=$(ARCH) modules_install |
| 33 | |
| 34 | clean: |
| 35 | $(MAKE) -C $(CPKERN) V=$(VERBOSITY) M=$(CURDIR) clean |