Skip to content

Commit 0e89e65

Browse files
authored
Merge pull request #69 from buttfa/feature_library
Little changes about Makefile
2 parents f4e1683 + 0a9437f commit 0e89e65

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

Makefile

+21-26
Original file line numberDiff line numberDiff line change
@@ -21,49 +21,35 @@ pch:
2121
# TODO(avh): change extension based on platform
2222
# Get the current OS name
2323
OS = $(shell uname | tr -d '\n')
24+
# Set the specific variables for each platform
2425
LIB_PATH ?= /usr/lib
2526
HEADER_PATH ?= /usr/include
26-
# Set the specific variables for each platform
2727
ifeq ($(OS), Linux)
28-
OS_TYPE ?= Linux
29-
30-
GPU_CPP_LIB_NAME ?= libgpucpp.so
31-
DAWN_LIB_NAME ?= libdawn.so
28+
OS_TYPE ?= Linux
29+
GPU_CPP_LIB_NAME ?= libgpucpp.so
30+
DAWN_LIB_NAME ?= libdawn.so
3231
else ifeq ($(OS), Darwin)
33-
OS_TYPE ?= macOS
34-
35-
GPU_CPP_LIB_NAME ?= libgpucpp.dylib
36-
DAWN_LIB_NAME ?= libdawn.dylib
32+
OS_TYPE ?= macOS
33+
GPU_CPP_LIB_NAME ?= libgpucpp.dylib
34+
DAWN_LIB_NAME ?= libdawn.dylib
3735
else
38-
OS_TYPE ?= unknown
36+
OS_TYPE ?= unknown
3937
endif
4038

4139
lib: check-clang dawnlib
42-
ifneq ($(OS_TYPE), unknown)
4340
mkdir -p build && $(CXX) -std=c++17 $(INCLUDES) -L$(LIBDIR) -ldawn -ldl -shared -fPIC gpu.cpp -o build/$(GPU_CPP_LIB_NAME)
4441
python3 build.py
4542
cp third_party/lib/$(DAWN_LIB_NAME) build/
46-
else
47-
@echo "Unsupported operating system"
48-
endif
4943

5044
install:
51-
ifneq ($(OS_TYPE), unknown)
5245
cp build/$(GPU_CPP_LIB_NAME) $(LIB_PATH)
5346
cp build/$(DAWN_LIB_NAME) $(LIB_PATH)
5447
cp build/gpu.hpp $(HEADER_PATH)
55-
else
56-
@echo "Unsupported operating system"
57-
endif
5848

5949
uninstall:
60-
ifneq ($(OS_TYPE), unknown)
6150
rm $(LIB_PATH)/$(GPU_CPP_LIB_NAME)
6251
rm $(LIB_PATH)/$(DAWN_LIB_NAME)
6352
rm $(HEADER_PATH)/gpu.hpp
64-
else
65-
@echo "Unsupported operating system"
66-
endif
6753

6854
examples/hello_world/build/hello_world: check-clang dawnlib examples/hello_world/run.cpp check-linux-vulkan
6955
$(LIBSPEC) && cd examples/hello_world && make build/hello_world && ./build/hello_world
@@ -139,15 +125,24 @@ clean-all:
139125
# Checks
140126
################################################################################
141127

128+
# Check all
129+
check-all: check-os check-clang check-cmake check-python
130+
131+
# check the os
132+
check-os:
133+
ifeq ($(OS_TYPE), unknown)
134+
$(error Unsupported operating system)
135+
endif
136+
142137
# check for the existence of clang++ and cmake
143138
check-clang:
144-
@command -v clang++ >/dev/null 2>&1 || { echo >&2 "Please install clang++ with 'sudo apt-get install clang' or 'brew install llvm'"; exit 1; }
139+
@command -v clang++ >/dev/null 2>&1 || { echo -e >&2 "Clang++ is not installed. Please install clang++ to continue.\nOn Debian / Ubuntu: 'sudo apt-get install clang' or 'brew install llvm'\nOn Centos: 'sudo yum install clang'"; exit 1; }
145140

146141
check-cmake:
147-
@command -v cmake >/dev/null 2>&1 || { echo >&2 "Please install cmake with 'sudo apt-get install cmake' or 'brew install cmake'"; exit 1; }
142+
@command -v cmake >/dev/null 2>&1 || { echo -e >&2 "Cmake is not installed. Please install cmake to continue.\nOn Debian / Ubuntu: 'sudo apt-get install cmake' or 'brew install cmake'\nOn Centos: 'sudo yum install cmake'"; exit 1; }
148143

149144
check-python:
150-
@command -v python3 >/dev/null 2>&1 || { echo >&2 "Python needs to be installed and in your path."; exit 1; }
145+
@command -v python3 >/dev/null 2>&1 || { echo -e >&2 "Python is not installed. Please install python to continue.\nOn Debian / Ubuntu: 'sudo apt-get install python'\nOn Centos: 'sudo yum install python'"; exit 1; }
151146

152147
check-linux-vulkan:
153148
@echo "Checking system type and Vulkan availability..."
@@ -156,7 +151,7 @@ check-linux-vulkan:
156151
echo "Vulkan is installed."; \
157152
vulkaninfo; \
158153
else \
159-
echo "Vulkan is not installed. Please install Vulkan drivers to continue. On Debian / Ubuntu: sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-tools"; \
154+
echo -e "Vulkan is not installed. Please install Vulkan drivers to continue.\nOn Debian / Ubuntu: 'sudo apt install libvulkan1 mesa-vulkan-drivers vulkan-tools'.\nOn Centos: 'sudo yum install vulkan vulkan-tools.'"; \
160155
exit 1; \
161156
fi \
162157
else \

0 commit comments

Comments
 (0)