diff options
Diffstat (limited to 'recipes/ti/files/Makefile-dsplink-gpp')
-rwxr-xr-x | recipes/ti/files/Makefile-dsplink-gpp | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/recipes/ti/files/Makefile-dsplink-gpp b/recipes/ti/files/Makefile-dsplink-gpp new file mode 100755 index 0000000000..d9f2f6209a --- /dev/null +++ b/recipes/ti/files/Makefile-dsplink-gpp @@ -0,0 +1,120 @@ +# Composite Makefile +DIRSEP=/ + +TI_DSPLINK_RELATIVE_PATH :=../../../../ + +# include the CURRENTCFG.mk +include $(DSPLINK)$(DIRSEP)config$(DIRSEP)BUILD$(DIRSEP)CURRENTCFG.MK + +# Generate the list of sources +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)arch$(DIRSEP)SOURCES +ARCH_SOURCES := $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)arch$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)ldrv$(DIRSEP)SOURCES +LDRV_SOURCES := $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)ldrv$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)ldrv$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)SOURCES +LDRV_SOURCES += $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)ldrv$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)gen$(DIRSEP)SOURCES +GEN_SOURCES := $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)gen$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)pmgr$(DIRSEP)SOURCES +PMGR_SOURCES := $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)pmgr$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)pmgr$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)SOURCES +PMGR_SOURCES += $(addpreifx $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)pmgr$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)pmgr$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)$(TI_DSPLINK_GPPOSVERSION)$(DIRSEP)SOURCES +PMGR_SOURCES += $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)pmgr$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)$(TI_DSPLINK_GPPOSVERSION)$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)osal$(DIRSEP)SOURCES +OSAL_SOURCES := $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)osal$(DIRSEP)$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)osal$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)SOURCES +OSAL_SOURCES += $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)osal$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)osal$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)$(TI_DSPLINK_GPPOSVERSION)$(DIRSEP)SOURCES +OSAL_SOURCES += $(addprefix $(TI_DSPLINK_RELATIVE_PATH)gpp$(DIRSEP)src$(DIRSEP)osal$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)$(TI_DSPLINK_GPPOSVERSION)$(DIRSEP),$(SOURCES)) + +DSPLINK_SOURCES := $(ARCH_SOURCES) $(LDRV_SOURCES) $(GEN_SOURCES) $(OSAL_SOURCES) $(PMGR_SOURCES) +DSPLINK_OBJS := $(foreach srcFile, $(DSPLINK_SOURCES),$(basename $(srcFile)).o) + +# EXTRA_CFLAGS +EXTRA_CFLAGS += $(addprefix -D, $(TI_DSPLINK_GPP_DEFINES)) +EXTRA_CFLAGS += $(addprefix -I, $(TI_DSPLINK_GPP_INC_PATH)) +EXTRA_CFLAGS += -DEXPORT_SYMTAB +EXTRA_CFLAGS += -DTRACE_KERNEL + +ifneq ($(KERNELRELEASE),) +obj-m := dsplinkk.o +dsplinkk-objs := $(DSPLINK_OBJS) +else +KDIR := /path/to/kernel/ +PWD := $(shell pwd) +driver: + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules +endif + +clean: + @echo DSPLINK - cleaning driver, library and samples + find $(DSPLINK) -name "*.o" -exec rm {} \; + rm -fr dsplinkk.ko dsplinkk.mod.c Module.symvers *gpp *.a *.lib + +################################################################################################ +# USER SIDE +BUILD_CONFIG := ..$(DIRSEP)..$(DIRSEP)..$(DIRSEP)config$(DIRSEP)BUILD +# Generate the list of sources +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)api$(DIRSEP)SOURCES +API_SOURCES := $(addprefix $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)api$(DIRSEP),$(SOURCES)) +SOURCES := +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)api$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)SOURCES +API_SOURCES += $(addprefix $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)api$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP),$(SOURCES)) + +# Update the CFLAG +#CC = arm-none-linux-gnueabi-gcc +#AR = arm-none-linux-gnueabi-ar +#LD = arm-none-linux-gnueabi-ld +ARFLAGS = -rs +LDFLAGS = -r +EXTRA_CFLAGS += $(addprefix -D, $(TI_DSPLINK_GPP_DEFINES)) $(addprefix -I, $(TI_DSPLINK_GPP_INC_PATH)) + +define CONFIG_template +$(shell cp $(DSPLINK)$(DIRSEP)config$(DIRSEP)all$(DIRSEP)$(1) $(DSPLINK)$(DIRSEP)config$(DIRSEP)BUILD$(DIRSEP)) +endef + +define PROGRAM_template +$(basename $(1)).o: $(1) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $(1) -o $(basename $(1)).o +endef +$(foreach prog,$(API_SOURCES),$(eval $(call PROGRAM_template,$(prog)))) +$(foreach prog,$(CONFIG),$(eval $(call CONFIG_template,$(prog)))) + +DSPLINK_API_OBJS := $(foreach srcFile, $(API_SOURCES),$(basename $(srcFile)).o) + +library: $(DSPLINK_API_OBJS) + @echo DSPLINK - building user library - dsplink.lib + $(LD) $(LDFLAGS) -o dsplink.lib $(DSPLINK_API_OBJS) + $(AR) $(ARFLAGS) dsplink.a $(DSPLINK_API_OBJS) + + +######################################### SAMPLES ################################### +SOURCES := +define SAMPLES_template +ifneq ($(1),message_multi) +$(1): $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(1).c $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)$(1)_os.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1) -I$(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS) -o $(1)gpp $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(1).c $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)$(1)_os.c $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)main.c dsplink.lib -lpthread +else +$(1): $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)message.c $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)message_os.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1) -I$(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS) -o $(1)gpp $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)message.c $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)message_os.c $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)$(1)$(DIRSEP)$(TI_DSPLINK_GPPOS)$(DIRSEP)main.c dsplink.lib -lpthread +endif +endef + +include $(TI_DSPLINK_GPPROOT)$(DIRSEP)src$(DIRSEP)samples$(DIRSEP)DIRS +$(foreach prog,$(DIRS),$(eval $(call SAMPLES_template,$(prog)))) + +samples: $(foreach prog,$(DIRS),$(prog)) + +all: driver library samples |