xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/Makefile.com (revision e8d3efa1c56e5f2b5368600a2baeb7b1d54a07f8)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
23# Copyright 2020 Joyent, Inc.
24# Copyright 2023 Oxide Computer Company
25#
26
27LIBRARY = libtopo.a
28VERS = .1
29
30BUILTINSRCS = \
31	cpu.c \
32	dev.c \
33	fmd.c \
34	hc.c \
35	legacy_hc.c \
36	mem.c \
37	mod.c \
38	pcie.c \
39	pkg.c \
40	svc.c \
41	sw.c \
42	zfs.c
43
44LIBSRCS = \
45	topo_2xml.c \
46	topo_alloc.c \
47	topo_builtin.c \
48	topo_digraph.c \
49	topo_digraph_xml.c \
50	topo_error.c \
51	topo_file.c \
52	topo_fmri.c \
53	topo_list.c \
54	topo_method.c \
55	topo_mod.c \
56	topo_module.c \
57	topo_node.c \
58	topo_nvl.c \
59	topo_parse.c \
60	topo_prop.c \
61	topo_protocol.c \
62	topo_rtld.c \
63	topo_snap.c \
64	topo_string.c \
65	topo_subr.c \
66	topo_tables.c \
67	topo_tree.c \
68	topo_xml.c
69
70OBJECTS = $(BUILTINSRCS:%.c=%.o) $(LIBSRCS:%.c=%.o)
71
72include ../../../../Makefile.lib
73include ../../../Makefile.lib
74
75SRCS = $(BUILTINSRCS:%.c=../common/%.c) $(LIBSRCS:%.c=../common/%.c)
76LIBS = $(DYNLIB)
77
78SRCDIR =	../common
79
80CLEANFILES += $(SRCDIR)/topo_error.c $(SRCDIR)/topo_tables.c
81
82CPPFLAGS += -I../common -I$(ADJUNCT_PROTO)/usr/include/libxml2 -I.
83CSTD = $(CSTD_GNU99)
84CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
85CFLAGS += -D_POSIX_PTHREAD_SEMANTICS
86CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
87
88$(DYNLIB)  := LDLIBS += \
89	-lnvpair -lelf -lumem -lxml2 -lkstat -luuid -ldevinfo \
90	-lsmbios -lc -ldevid -lipmi -lscf -lpcidb
91NATIVE_LIBS +=	libxml2.so
92
93.KEEP_STATE:
94
95all: $(LIBS)
96
97pics/%.o: ../$(MACH)/%.c
98	$(COMPILE.c) -o $@ $<
99	$(POST_PROCESS_O)
100
101%.o: ../common/%.c
102	$(COMPILE.c) -o $@ $<
103	$(POST_PROCESS_O)
104
105../common/topo_error.c: ../common/mkerror.sh ../common/topo_error.h
106	sh ../common/mkerror.sh liberrors < ../common/topo_error.h > $@
107	sh ../common/mkerror.sh properrors < ../common/libtopo.h >> $@
108	sh ../common/mkerror.sh methoderrors < ../common/libtopo.h >> $@
109	sh ../common/mkerror.sh fmrierrors < ../common/libtopo.h >> $@
110	sh ../common/mkerror.sh hdlerrors < ../common/libtopo.h >> $@
111	sh ../common/mkerror.sh moderrors < ../common/topo_mod.h >> $@
112
113$(SRCDIR)/topo_tables.c: $(SRCDIR)/mktables.sh $(SRCDIR)/libtopo.h
114	sh $(SRCDIR)/mktables.sh $(SRCDIR)/libtopo.h > $@
115
116include ../../../../Makefile.targ
117include ../../../Makefile.targ
118