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
52 NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
55 NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3)
58 NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
61 NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
68 @echo Configuring Blender ...
70 if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
71 cmake -H$(BLENDER_DIR) -B$(BUILD_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE) ; \
75 @echo Building Blender ...
76 make -C $(BUILD_DIR) -s -j $(NPROCS) install
78 @echo run blender from "$(BUILD_DIR)/bin/blender"
86 cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
89 cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot
92 make -C $(BUILD_DIR) -s package_archive
93 @echo archive in "$(BUILD_DIR)/release"
95 # forward build targets
97 cd $(BUILD_DIR) ; ctest . --output-on-failure
99 # run pep8 check check on scripts we distribute.
101 python source/tests/pep8.py > test_pep8.log 2>&1
102 @echo "written: test_pep8.log"
104 # run some checks on our cmakefiles.
106 python build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
107 @echo "written: test_cmake_consistency.log"
110 make -C $(BUILD_DIR) clean