xref: /illumos-gate/usr/src/uts/Makefile.mapfile (revision d3b5f56344d8bfcdd6cfb82446af0e5e55ad9ebe)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2016 Joyent, Inc.
14#
15
16#
17# This Makefile should be included in individual kernel modules to opt
18# into a -z defs world. Note, this should be included after a MAPFILES
19# entry is defined. See uts/common/README.mapfiles for more information.
20#
21
22#
23# Mapfile base
24#
25MAPBASE = $(UTSBASE)/common/mapfiles
26DTRACE_MAPFILE = $(OBJS_DIR)/dtrace.mapfile
27
28#
29# Always append -z defs to the LD FLAGS and append all mapfiles.
30#
31LDFLAGS += -z defs $(MAPFILES:%=-M $(MAPBASE)/%.mapfile) -M $(DTRACE_MAPFILE)
32
33#
34# Definitions and rules to assemble the DTrace probe mapfile. There's no
35# good way to automatically do this, hence we have a slightly gross
36# series of automated tools. This does mean that we have a bit more work
37# to do, but also means that probes can be added arbitrarily without
38# having to manually edit mapfiles.
39#
40DTRACE_AWK_FILE = $(MAPBASE)/dtrace.mapfile.awk
41
42$(OBJS_DIR)/dtrace.mapfile: $(OBJECTS) $(DTRACE_AWK_FILE)
43	$(NM) -u $(OBJECTS) | $(AWK) -f $(DTRACE_AWK_FILE) > $@
44