blob: bf58d2a01de9ee17049a229ac3119f5e633c4307 [file] [log] [blame]
Kyle Swenson74ad7532023-02-16 11:05:29 -07001# Makefile for cpmodem_shim net_device hooks.
2
3ROOT ?= $(abspath ../../..)
4include $(ROOT)/Makefile.config
5
6VERBOSITY := $(if $(filter $(MAKEVERBOSE),yes),1,0)
7EXTRA_CFLAGS := -I$(CURDIR)/include
8
9#uncomment for debugging
10#EXTRA_CFLAGS += -O0
11#EXTRA_CFLAGS += -g
12
13unexport 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.
20CPNEWDEFINES := $(filter -DPRODUCT_INFO_CHIPSET=% -DPRODUCT_INFO_MEMORY=% -DPRODUCT_PLATFORM=%, $(CPDEFINES))
21CPNEWDEFINES := $(patsubst -DPRODUCT_INFO_CHIPSET='%', -DPRODUCT_INFO_CHIPSET=%, $(CPNEWDEFINES))
22CPNEWDEFINES := $(patsubst -DPRODUCT_INFO_CHIPSET=%, -DPRODUCT_INFO_CHIPSET=\\\"%\\\", $(CPNEWDEFINES))
23CPNEWDEFINES := $(patsubst -DPRODUCT_PLATFORM=%, -DPRODUCT_PLATFORM=\\\"%\\\", $(CPNEWDEFINES))
24EXTRA_CFLAGS += $(CPNEWDEFINES)
25
26default: install
27
28all:
29 $(MAKE) -C $(CPKERN) V=$(VERBOSITY) M=$(CURDIR) EXTRA_CFLAGS="$(EXTRA_CFLAGS)"
30
31install: all
32 $(MAKE) -C $(CPKERN) M=$(CURDIR) INSTALL_MOD_PATH=$(ROOT)/$(IMGDIR)/rootfs ARCH=$(ARCH) modules_install
33
34clean:
35 $(MAKE) -C $(CPKERN) V=$(VERBOSITY) M=$(CURDIR) clean