similarity index 53%
rename from examples/dsponly/dgemm_test/Makefile.libomp
rename to examples/dsponly/common/Makefile.common
index 683d3b8a3df340d781459bf40de2c946cc0343d7..0e76de80b2a731f07ff7145a2586d8a626300f92 100644 (file)
rename from examples/dsponly/dgemm_test/Makefile.libomp
rename to examples/dsponly/common/Makefile.common
index 683d3b8a3df340d781459bf40de2c946cc0343d7..0e76de80b2a731f07ff7145a2586d8a626300f92 100644 (file)
-#
-# Makefile.libomp
-#
+# Makefile to build OpenMP applications
+
+default: all
# Configuration file used (without the .cfg extension)
CFGDIR = omp_config
@@ -26,15 +26,48 @@ XDCPATH = $(PDK_DIR)/packages;$(OMP_DIR)/packages;$(BIOS_DIR)/packages;$(IPC_DIR
XS = $(XDC_DIR)/xs
XDC = $(XDC_DIR)/xdc
-XDCTARGET = ti.targets.elf.C66
+XDCTARGET = ti.targets.elf.C66
+
+#
+# Compiler option configuration
+#
+LNK_CMD = $(CFGDIR)/linker.cmd
+LNK_CMD_FC= $(COMMON_FOLDER)/linker_fc.cmd
+OPT_CMD = $(CFGDIR)/compiler.opt
+LNK_OPTS = -x -c --priority -w
+CL = $(CGTROOT)/bin/cl6x
+RTS_LIB = $(CGTROOT)/lib/libc.a
+LIBARCH_LIB = $(LIBARCH_DIR)/lib/libArch.ae66
+LINALG_LIB = $(LINALG_DIR)/lib/libcblas.ae66
+
+ifeq ($(BUILD_TYPE),debug)
+ CL_OPTS += -g --optimize_with_debug=on
+else
+ CL_OPTS += -o3
+endif
+
+
+all: $(outfile)
# Generate and build libomp config packages
libomp_config:
@echo making $(CFGDIR) files
+ cp $(COMMON_FOLDER)/$(CFGDIR).cfg .
$(XS) --xdcpath "$(XDCPATH)" xdc.tools.configuro -c $(CGTROOT) --cb -t $(XDCTARGET) -p $(XDCPLATFORM) -r $(BUILD_TYPE) $(CFGDIR).cfg
libomp_clean:
@echo Removing $(CFGDIR)
@rm -rf $(CFGDIR)/
+%.out: $(testfiles) libomp_config
+ echo compiling $<
+ $(CL) $(CL_OPTS) $(testfiles) -z $(LNK_OPTS) -o $@ -m $*.map $(LNK_CMD) $(LNK_CMD_FC) $(RTS_LIB) $(LIBARCH_LIB) $(LINALG_LIB)
+clean: libomp_clean
+ @rm -rf *.map *.out *.obj *.mak $(CFGDIR).cfg
+
+#
+# Cleans libomp artifacts
+#
+realclean: libomp_clean
+ @rm -rf *.map *.out *.obj *.mak