]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - openmp/ti-openmpacc.git/blobdiff - Makefile
Merge branch 'release/v01.05.05.00'
[openmp/ti-openmpacc.git] / Makefile
index 09079b468c8573ce26f3d6d9439b9a15d8ec1ca5..a2cda91e9f5b9ca96a7398d15eab224c04aa3891 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 ##
-##  Copyright (c) 2014-2015, Texas Instruments Incorporated
+##  Copyright (c) 2014-2018, Texas Instruments Incorporated
 ##
 ##  Redistribution and use in source and binary forms, with or without
 ##  modification, are permitted provided that the following conditions
 ##  ======== Makefile ========
 ##
 
-.PHONY: all clean openmpacc install prebuild clean-prebuild
+.PHONY: all clean openmpacc install examples
 .SILENT:
 
 include Makefile.inc
 
-# Get build and install rules 
-include make.def
+OMPACC_DPKG_NAME       := ti-openmpacc
+OMPACC_BUILD_DIR       := build/$(TARGET)
+OMPACC_SRC_DIR         := host
+OMPACC_EXAMPLES_DIR := examples
+
+BUILD_MACHINE=$(shell uname -m)
+
+ifeq (,$(findstring arm,$(BUILD_MACHINE)))
+OMPACC_CMAKE_OPTS=-DCMAKE_TOOLCHAIN_FILE=../../${OMPACC_SRC_DIR}/CMakeARMToolChain.txt -DCROSS_BUILD=ON -DVERSION="$(OMPACC_VER)"
+else
+OMPACC_CMAKE_OPTS=
+endif
+
+all: openmpacc examples
+
+examples: openmpacc
+       $(MAKE) -C $(OMPACC_EXAMPLES_DIR)
+
+openmpacc: $(OMPACC_BUILD_DIR)/Makefile
+       $(MAKE) -C $(OMPACC_BUILD_DIR)
+
+$(OMPACC_BUILD_DIR)/Makefile: $(filter-out $(wildcard $(OMPACC_BUILD_DIR)), $(OMPACC_BUILD_DIR))
+       cd $(OMPACC_BUILD_DIR); cmake $(OMPACC_CMAKE_OPTS) ../../${OMPACC_SRC_DIR}
+
+$(OMPACC_BUILD_DIR):
+       $(eval OMPACC_VER := $(shell cat $(OMPACC_SRC_DIR)/version.txt))
+       mkdir -p $(OMPACC_BUILD_DIR)
+
+install: openmpacc
+       $(MAKE) -C ${OMPACC_BUILD_DIR} install
+
+clean:
+       $(MAKE) -C $(OMPACC_SRC_DIR)/clacc clean
+       rm -rf build/*
+
+fresh: clean install
 
 ifneq ($(ARM_GCC_DIR),)
 export PATH:=$(ARM_GCC_DIR)/bin:$(PATH)
 endif
 
-export LINUX_DEVKIT_ROOT ?= $(MCSDK_LINUX_DEVKIT_ROOT)
-
 OMPACC_VER := $(shell cat $(OMPACC_SRC_DIR)/version.txt)
-OMPACC_TAG := v$(OMPACC_VER)
-OMPACC_VERSIONED_NAME := $(OMPACC_DPKG_NAME)_$(OMPACC_VER)
-
-clean-prebuild: 
-       -rm -f $(OMPACC_VERSIONED_NAME).tar.gz
-       -rm -f $(OMPACC_VERSIONED_NAME)
 
-prebuild:
-       ln -s . $(OMPACC_VERSIONED_NAME) 
-       tar czvf $(OMPACC_VERSIONED_NAME).tar.gz --exclude='.git' --exclude="validate.py" --exclude="boost_*" --exclude="*.tar.gz" --exclude="*.swp" --exclude="*objs" --exclude="clacc_*" --exclude="tags" --transform='s/Makefile.Arm/Makefile/g' $(OMPACC_VERSIONED_NAME)/$(OMPACC_SRC_DIR) $(OMPACC_VERSIONED_NAME)/$(OMPACC_EXAMPLES_DIR) $(OMPACC_VERSIONED_NAME)/debian $(OMPACC_VERSIONED_NAME)/Makefile.Arm $(OMPACC_VERSIONED_NAME)/make.def
-       rm $(OMPACC_VERSIONED_NAME)
+export LINUX_DEVKIT_ROOT
+export DESTDIR?=$(CURDIR)/install/$(TARGET)
 
-realclean: clean clean-prebuild
+realclean: clean
        $(MAKE) -C $(OMPACC_SRC_DIR)/boost clean