(no commit message)
[blender-staging.git] / GNUmakefile
index 17aef9075b2bbb2d7f5210e187a20848890a60d1..008dfe77eae9fa80e572cf4ce5b36111070ae4b0 100644 (file)
 
 # 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 pwd -P)
-BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS)_$(CPU)
+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
@@ -42,7 +52,7 @@ ifeq ($(OS), Linux)
        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 " | cut -d" " -f3 )
@@ -60,14 +70,45 @@ all:
        if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \
                mkdir -p $(BUILD_DIR) ; \
                cd $(BUILD_DIR) ; \
-               cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=Release ; \
+               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
+
+# run pep8 check check on scripts we distribute.
+test_pep8:
+       python source/tests/pep8.py > test_pep8.log 2>&1
+       @echo "written: test_pep8.log"
+
+# run some checks on our cmakefiles.
+test_cmake:
+       python build_files/cmake/cmake_consistency_check.py > test_cmake_consistency.log 2>&1
+       @echo "written: test_cmake_consistency.log"
+
+clean:
+       cd $(BUILD_DIR) ; make clean
+
 .PHONY: all