diff options
Diffstat (limited to 'userspace/Makefile')
-rw-r--r-- | userspace/Makefile | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/userspace/Makefile b/userspace/Makefile new file mode 100644 index 00000000..70e93bad --- /dev/null +++ b/userspace/Makefile | |||
@@ -0,0 +1,73 @@ | |||
1 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. | ||
2 | # | ||
3 | # Permission is hereby granted, free of charge, to any person obtaining a | ||
4 | # copy of this software and associated documentation files (the "Software"), | ||
5 | # to deal in the Software without restriction, including without limitation | ||
6 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
7 | # and/or sell copies of the Software, and to permit persons to whom the | ||
8 | # Software is furnished to do so, subject to the following conditions: | ||
9 | # | ||
10 | # The above copyright notice and this permission notice shall be included in | ||
11 | # all copies or substantial portions of the Software. | ||
12 | # | ||
13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
16 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
18 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
19 | # DEALINGS IN THE SOFTWARE. | ||
20 | |||
21 | # Turn off suffix rules. They are deprecated. | ||
22 | .SUFFIXES: | ||
23 | |||
24 | # Full paths. Makes submakefiles easier. That said this make file _must_ be run | ||
25 | # from <NVGPU>/userspace/. | ||
26 | TWD=$(CURDIR) | ||
27 | |||
28 | # Top level out dir. | ||
29 | OUT=$(TWD)/build | ||
30 | |||
31 | # Nvgpu driver code. | ||
32 | NVGPU_SRC=$(TWD)/../drivers/gpu/nvgpu | ||
33 | NVGPU_OUT=$(OUT)/libnvgpu | ||
34 | |||
35 | INCLUDES= \ | ||
36 | -I$(NVGPU_SRC) \ | ||
37 | -I$(NVGPU_SRC)/include \ | ||
38 | -I../include \ | ||
39 | -I../include/uapi | ||
40 | |||
41 | CONFIGS= \ | ||
42 | -D__NVGPU_POSIX__ | ||
43 | |||
44 | # Compiler, c-flags, etc. | ||
45 | |||
46 | # CC = clang | ||
47 | CC = gcc | ||
48 | CFLAGS = -Wall -ggdb -Werror -fPIC $(INCLUDES) $(CONFIGS) | ||
49 | LIBS = -lpthread -pthread | ||
50 | |||
51 | # Source files. We expect $(OBJS) and $(HEADERS) to get filled in here. | ||
52 | include Makefile.sources | ||
53 | |||
54 | # Linuxy configs. We want these so that we can mirror builds from the actual | ||
55 | # Linux kernel. | ||
56 | include Makefile.configs | ||
57 | |||
58 | all: $(OUT)/libnvgpu-drv.so | ||
59 | |||
60 | $(OUT)/libnvgpu-drv.so: $(OBJS) | ||
61 | $(CC) -shared -o $(OUT)/libnvgpu-drv.so $(OBJS) -lgcov | ||
62 | |||
63 | # Default build target for all the object files we want to build in userspace. | ||
64 | $(NVGPU_OUT)/%.o : $(NVGPU_SRC)/%.c $(HEADERS) | ||
65 | @if [ ! -d $(dir $@) ] ; then \ | ||
66 | mkdir -p $(dir $@) ; \ | ||
67 | fi | ||
68 | $(CC) $(CFLAGS) $(configs) -c -o $@ $< | ||
69 | |||
70 | .PHONY: clean | ||
71 | |||
72 | clean: | ||
73 | rm -rf $(OUT) | ||