1 # -*- mode: gnumakefile; tab-width: 8; indent-tabs-mode: t; -*-
5 # ##### BEGIN GPL LICENSE BLOCK #####
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 # ##### END GPL LICENSE BLOCK #####
23 # This Makefile does an out-of-source CMake build in ../build/`OS`_`CPU`
26 # This is for users who like to configure & build blender with a single command.
31 OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')
32 # CPU:=$(shell uname -m) # UNUSED
35 # Source and Build DIR's
36 BLENDER_DIR:=$(shell pwd -P)
37 BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
40 # support 'make debug'
41 ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
42 BUILD_DIR:=$(BUILD_DIR)_debug
49 # Get the number of cores for threaded build
51 DEFAULT_TARGET=install
53 NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
56 NPROCS:=$(shell system_profiler SPHardwareDataType | awk '/Total Number Of Cores/ {print $5}{next;};')
57 # make install not support on mac yet
61 NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
64 NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
71 @echo Configuring Blender ...
73 if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
74 mkdir -p $(BUILD_DIR) ; \
76 cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE) ; \
80 @echo Building Blender ...
81 cd $(BUILD_DIR) ; make -s -j $(NPROCS) ${DEFAULT_TARGET}
83 @echo run blender from "$(BUILD_DIR)/bin/blender"
91 cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
94 cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot
96 # forward build targets
98 cd $(BUILD_DIR) ; ctest . --output-on-failure
101 cd $(BUILD_DIR) ; make clean