-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (47 loc) · 1.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
SHELL := /bin/bash
# Rez variables, setting these to sensible values if we are not building from rez
REZ_BUILD_PROJECT_VERSION ?= NOT_SET
REZ_BUILD_INSTALL_PATH ?= /usr/local
REZ_BUILD_SOURCE_PATH ?= $(shell dirname $(lastword $(abspath $(MAKEFILE_LIST))))
BUILD_ROOT := $(REZ_BUILD_SOURCE_PATH)/build
REZ_BUILD_PATH ?= $(BUILD_ROOT)
# Build time locations
SOURCE_DIR := $(BUILD_ROOT)/openexr/
BUILD_TYPE = Release
BUILD_DIR = ${REZ_BUILD_PATH}/BUILD/$(BUILD_TYPE)
# Source
REPOSITORY_URL := https://github.com/AcademySoftwareFoundation/openexr.git
TAG ?= v$(REZ_BUILD_PROJECT_VERSION)
# Installation prefix
PREFIX ?= ${REZ_BUILD_INSTALL_PATH}
# CMake Arguments
CMAKE_ARGS := -DCMAKE_INSTALL_PREFIX=$(PREFIX) \
-DOPENEXR_FORCE_INTERNAL_IMATH=ON \
-DOPENEXR_FORCE_INTERNAL_ZLIB=ON \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_SKIP_RPATH=ON
# Warn about building master if no tag is provided
ifeq "$(TAG)" "vNOT_SET"
$(warning "No tag was specified, main will be built. You can specify a tag: TAG=v2.1.0")
TAG:=master
endif
.PHONY: build install test clean
.DEFAULT: build
$(BUILD_DIR): # Prepare build directories
mkdir -p $(BUILD_ROOT)
mkdir -p $(BUILD_DIR)
$(SOURCE_DIR): | $(BUILD_DIR) # Clone the repository
cd $(BUILD_ROOT) && git clone $(REPOSITORY_URL)
build: $(SOURCE_DIR) # Checkout the correct tag and build
cd $(SOURCE_DIR) && git checkout $(TAG)
cd $(BUILD_DIR) && cmake $(CMAKE_ARGS) $(SOURCE_DIR) && make
install: build
cd $(BUILD_DIR) && make install
install: install
mkdir -p $(PREFIX)
cd $(BUILD_DIR) && make install
test: build_shared # Run the tests in the build
$(MAKE) -C $(BUILD_DIR) test
clean:
rm -rf $(BUILD_ROOT)