Add cpmodem_shim
Change-Id: I469fe04efac7b6636f9d2d1a8ae93c6c1ac30dc1
diff --git a/cpmodem_shim/Makefile b/cpmodem_shim/Makefile
new file mode 100644
index 0000000..bf58d2a
--- /dev/null
+++ b/cpmodem_shim/Makefile
@@ -0,0 +1,35 @@
+# Makefile for cpmodem_shim net_device hooks.
+
+ROOT ?= $(abspath ../../..)
+include $(ROOT)/Makefile.config
+
+VERBOSITY := $(if $(filter $(MAKEVERBOSE),yes),1,0)
+EXTRA_CFLAGS := -I$(CURDIR)/include
+
+#uncomment for debugging
+#EXTRA_CFLAGS += -O0
+#EXTRA_CFLAGS += -g
+
+unexport CC CPP LD CFLAGS CPPFLAGS LDFLAGS AR RANLIB
+
+# grab the chipset, platform and memory defines from CPDEFINES. PRODUCT_INFO_CHIPSET can be in two forms (an int or a python invalid string):
+# -DPRODUCT_INFO_CHIPSET=1234 or -DPRODUCT_INFO_CHIPSET='1234'
+# PRODUCT_INFO_MEMORY is always an int so can use directly
+# PRODUCT_PLATFORM is a symbol so needs double quotes added to turn it into a string
+# 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.
+CPNEWDEFINES := $(filter -DPRODUCT_INFO_CHIPSET=% -DPRODUCT_INFO_MEMORY=% -DPRODUCT_PLATFORM=%, $(CPDEFINES))
+CPNEWDEFINES := $(patsubst -DPRODUCT_INFO_CHIPSET='%', -DPRODUCT_INFO_CHIPSET=%, $(CPNEWDEFINES))
+CPNEWDEFINES := $(patsubst -DPRODUCT_INFO_CHIPSET=%, -DPRODUCT_INFO_CHIPSET=\\\"%\\\", $(CPNEWDEFINES))
+CPNEWDEFINES := $(patsubst -DPRODUCT_PLATFORM=%, -DPRODUCT_PLATFORM=\\\"%\\\", $(CPNEWDEFINES))
+EXTRA_CFLAGS += $(CPNEWDEFINES)
+
+default: install
+
+all:
+ $(MAKE) -C $(CPKERN) V=$(VERBOSITY) M=$(CURDIR) EXTRA_CFLAGS="$(EXTRA_CFLAGS)"
+
+install: all
+ $(MAKE) -C $(CPKERN) M=$(CURDIR) INSTALL_MOD_PATH=$(ROOT)/$(IMGDIR)/rootfs ARCH=$(ARCH) modules_install
+
+clean:
+ $(MAKE) -C $(CPKERN) V=$(VERBOSITY) M=$(CURDIR) clean