+# -*- mode: gnumakefile; tab-width: 8; indent-tabs-mode: t; -*-
+# vim: tabstop=8
+# $Id$
+#
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# System Vars
OS:=$(shell uname -s)
-CPU:=$(shell uname -m)
+OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')
+# CPU:=$(shell uname -m) # UNUSED
# Source and Build DIR's
-BLENDER_DIR:=$(shell readlink $(PWD))
-BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS)_$(CPU)
+BLENDER_DIR:=$(shell pwd -P)
+BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
+
+
+# support 'make debug'
+ifneq "$(findstring debug, $(MAKECMDGOALS))" ""
+ BUILD_DIR:=$(BUILD_DIR)_debug
+ BUILD_TYPE:=Debug
+else
+ BUILD_TYPE:=Release
+endif
# Get the number of cores for threaded build
NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)
endif
ifeq ($(OS), Darwin)
- NPROCS:=$(shell system_profiler | awk '/Number Of CPUs/{print $4}{next;}')
+ NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3)
endif
ifeq ($(OS), FreeBSD)
- NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | awk '{print $3}')
+ NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
endif
ifeq ($(OS), NetBSD)
- NPROCS:=$(shell sysctl -a | grep "hw.ncpu" | awk '{print $3}')
+ NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )
endif
@echo Configuring Blender ...
if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
- mkdir --parents $(BUILD_DIR) ; \
+ mkdir -p $(BUILD_DIR) ; \
cd $(BUILD_DIR) ; \
- cmake $(BLENDER_DIR) ; \
+ cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE) ; \
fi
@echo
@echo Building Blender ...
- cd $(BUILD_DIR) ; make -s -j $(NPROCS)
+ cd $(BUILD_DIR) ; make -s -j $(NPROCS) install
@echo
@echo run blender from "$(BUILD_DIR)/bin/blender"
@echo
+debug: all
+ # pass
+
+# package types
+package_debian:
+ cd build_files/package_spec ; DEB_BUILD_OPTIONS="parallel=$(NPROCS)" sh ./build_debian.sh
+
+package_pacman:
+ cd build_files/package_spec/pacman ; MAKEFLAGS="-j$(NPROCS)" makepkg --asroot
+
+package_archive:
+ cd $(BUILD_DIR) ; make -s package_archive
+ @echo archive in "$(BUILD_DIR)/release"
+
+# forward build targets
+test:
+ cd $(BUILD_DIR) ; ctest . --output-on-failure
+
+clean:
+ cd $(BUILD_DIR) ; make clean
+
.PHONY: all