summaryrefslogtreecommitdiffstats
path: root/userspace/Makefile
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2018-01-22 19:30:53 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-07 07:41:26 -0400
commit6e739d924fe9b778fa82396e0e941143f498acb8 (patch)
treef112ede8573c2f8bf76e0bdaadf33c6c71343820 /userspace/Makefile
parente6b3bb4e6b3d4013f83ba6d31c780947f16cf410 (diff)
gpu: nvgpu: Userspace POSIX support
Add support for compiling nvgpu in a POSIX compliant userspace. This code adds all of the necessary abstraction interfaces (mostly stubbed) to enabled extremely limited and basic functionality in nvgpu. The goal of this code is to facilitate unit testing of the nvgpu common core. By doing this in userspace it is much easier to write tests that rely on very particular states within nvgpu since a user can very precisely control the state of nvgpu. JIRA NVGPU-525 Change-Id: I30e95016df14997d951075777e0585f912dc5960 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1683914 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'userspace/Makefile')
-rw-r--r--userspace/Makefile73
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/.
26TWD=$(CURDIR)
27
28# Top level out dir.
29OUT=$(TWD)/build
30
31# Nvgpu driver code.
32NVGPU_SRC=$(TWD)/../drivers/gpu/nvgpu
33NVGPU_OUT=$(OUT)/libnvgpu
34
35INCLUDES= \
36 -I$(NVGPU_SRC) \
37 -I$(NVGPU_SRC)/include \
38 -I../include \
39 -I../include/uapi
40
41CONFIGS= \
42 -D__NVGPU_POSIX__
43
44# Compiler, c-flags, etc.
45
46# CC = clang
47CC = gcc
48CFLAGS = -Wall -ggdb -Werror -fPIC $(INCLUDES) $(CONFIGS)
49LIBS = -lpthread -pthread
50
51# Source files. We expect $(OBJS) and $(HEADERS) to get filled in here.
52include Makefile.sources
53
54# Linuxy configs. We want these so that we can mirror builds from the actual
55# Linux kernel.
56include Makefile.configs
57
58all: $(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
72clean:
73 rm -rf $(OUT)