Debian Codegraph @

samples/Makefile

raw
1 #
2 # NV-CONTROL samples: Sample tools for configuring the NVIDIA X driver on Unix
3 # and Linux systems.
4 #
5 # Copyright (c) 2010 NVIDIA, Corporation
6 #
7 # Permission is hereby granted, free of charge, to any person obtaining a copy
8 # of this software and associated documentation files (the "Software"), to deal
9 # in the Software without restriction, including without limitation the rights
10 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 # copies of the Software, and to permit persons to whom the Software is
12 # furnished to do so, subject to the following conditions:
13 #
14 # The above copyright notice and this permission notice (including the next
15 # paragraph) shall be included in all copies or substantial portions of the
16 # Software.
17 #
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 # SOFTWARE.
25 #
26
27 ##############################################################################
28 # include common variables and functions
29 ##############################################################################
30
31 UTILS_MK_DIR ?= ..
32
33 include $(UTILS_MK_DIR)/utils.mk
34
35 XNVCTRL_DIR ?= ../src/libXNVCtrl
36
37 include $(XNVCTRL_DIR)/xnvctrl.mk
38
39
40 ##############################################################################
41 # The calling Makefile may export any of the following variables; we
42 # assign default values if they are not exported by the caller
43 ##############################################################################
44
45 CFLAGS += $(XNVCTRL_CFLAGS)
46 CFLAGS += -I $(XNVCTRL_DIR)
47 CFLAGS += -I $(OUTPUTDIR)
48
49 LDFLAGS += $(XNVCTRL_LDFLAGS)
50 LIBS += -lXext -lX11
51
52
53 ##############################################################################
54 # samples
55 ##############################################################################
56
57 SAMPLE_SOURCES += nv-control-info.c
58 SAMPLE_SOURCES += nv-control-dvc.c
59 SAMPLE_SOURCES += nv-control-events.c
60 SAMPLE_SOURCES += nv-control-dpy.c
61 SAMPLE_SOURCES += nv-control-targets.c
62 SAMPLE_SOURCES += nv-control-framelock.c
63 SAMPLE_SOURCES += nv-control-3dvisionpro.c
64 SAMPLE_SOURCES += nv-control-warpblend.c
65
66 ##############################################################################
67 # build rules
68 ##############################################################################
69
70 # define the rule to build each object file
71 $(foreach src, $(SAMPLE_SOURCES), $(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
72
73 # define the rule to link each sample app from its corresponding object file
74 define link_sample_from_object
75 $$(OUTPUTDIR)/$(1:.c=): $$(call BUILD_OBJECT_LIST,$(1)) $$(LIBXNVCTRL)
76 $$(call quiet_cmd,LINK) $$(CFLAGS) $$(LDFLAGS) $$(BIN_LDFLAGS) -o $$@ $$< $$(LIBXNVCTRL) $$(LIBS)
77
78 .PHONY: all
79 all: $$(OUTPUTDIR)/$(1:.c=)
80 SAMPLES += $$(OUTPUTDIR)/$(1:.c=)
81 endef
82
83 $(foreach sample,$(SAMPLE_SOURCES),$(eval $(call link_sample_from_object,$(sample))))
84
85 .PHONY: clean clobber
86 clean clobber:
87 rm -rf *~ $(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d $(SAMPLES) $(LIBXNVCTRL)
88
89 .PHONY: install
90 install:
91 @# don't install samples, this is just to satisfy the top-level
92 @# recursion rule