xref: /illumos-gate/usr/src/cmd/savecore/Makefile (revision 4702be99a7621a425e53a63af8ae0ff7fe973b31)
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#
23# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright (c) 2018, Joyent, Inc.
25# Copyright 2024 Oxide Computer Company
26#
27
28PROG= savecore
29OBJS= savecore.o compress.o
30
31include ../Makefile.cmd
32include ../Makefile.cmd.64
33include ../Makefile.ctf
34
35CSTD = $(CSTD_GNU99)
36
37CFLAGS += $(CCVERBOSE)
38CPPFLAGS += -DBZ_NO_STDIO -I$(SRC)/common -I$(SRC)/uts/common
39
40LDLIBS += -L$(ROOT)/usr/lib/fm/64 -lfmevent -lnvpair
41LDFLAGS += -R/usr/lib/fm/64
42
43
44#
45# savecore is compiled with bits from $(SRC)/common/bzip2 and some function
46# symbols there are defined as weak; if you leave them out of
47# savecore.c it will compile, but trying to call that function
48# will jump to 0.  So we use -ztext to avoid that.
49#
50LDFLAGS += $(ZTEXT)
51
52BZIP2OBJS =	bz2blocksort.o	\
53		bz2compress.o	\
54		bz2decompress.o	\
55		bz2randtable.o	\
56		bz2bzlib.o	\
57		bz2crctable.o	\
58		bz2huffman.o
59
60$(BZIP2OBJS) := SMOFF=indenting
61
62.KEEP_STATE:
63
64all: $(PROG)
65
66install: all $(ROOTPROG)
67
68$(PROG): $(OBJS) $(BZIP2OBJS)
69	$(LINK.c) -o $(PROG) $(OBJS) $(BZIP2OBJS) $(LDLIBS)
70	$(POST_PROCESS)
71
72clean:
73	$(RM) $(OBJS) $(BZIP2OBJS)
74
75include ../Makefile.targ
76
77%.o: ../../uts/common/os/%.c
78	$(COMPILE.c) $<
79	$(POST_PROCESS_O)
80
81bz2%.o: ../../common/bzip2/%.c
82	$(COMPILE.c) -o $@ -I$(SRC)/common/bzip2 $<
83	$(POST_PROCESS_O)
84