1702941cdSRichard Lowe# 2702941cdSRichard Lowe# CDDL HEADER START 3702941cdSRichard Lowe# 4702941cdSRichard Lowe# The contents of this file are subject to the terms of the 5702941cdSRichard Lowe# Common Development and Distribution License (the "License"). 6702941cdSRichard Lowe# You may not use this file except in compliance with the License. 7702941cdSRichard Lowe# 8702941cdSRichard Lowe# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9702941cdSRichard Lowe# or http://www.opensolaris.org/os/licensing. 10702941cdSRichard Lowe# See the License for the specific language governing permissions 11702941cdSRichard Lowe# and limitations under the License. 12702941cdSRichard Lowe# 13702941cdSRichard Lowe# When distributing Covered Code, include this CDDL HEADER in each 14702941cdSRichard Lowe# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15702941cdSRichard Lowe# If applicable, add the following below this CDDL HEADER, with the 16702941cdSRichard Lowe# fields enclosed by brackets "[]" replaced with your own identifying 17702941cdSRichard Lowe# information: Portions Copyright [yyyy] [name of copyright owner] 18702941cdSRichard Lowe# 19702941cdSRichard Lowe# CDDL HEADER END 20702941cdSRichard Lowe# 21702941cdSRichard Lowe# 22702941cdSRichard Lowe# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23702941cdSRichard Lowe# Use is subject to license terms. 24702941cdSRichard Lowe# 25*92c1a611SBryan Cantrill# Copyright (c) 2019, Joyent, Inc. 26702941cdSRichard Lowe 27702941cdSRichard Lowe# 28702941cdSRichard Lowe# The build process for libsaveargs is sightly different from that used by other 29702941cdSRichard Lowe# libraries, because libsaveargs must be built in two flavors - as a standalone 30702941cdSRichard Lowe# for use by kmdb and as a normal library. We use $(CURTYPE) to indicate the 31702941cdSRichard Lowe# current flavor being built. 32702941cdSRichard Lowe# 33702941cdSRichard Lowe 34702941cdSRichard LoweLIBRARY= libsaveargs.a 35702941cdSRichard LoweSTANDLIBRARY= libstandsaveargs.so 36702941cdSRichard LoweVERS= .1 37702941cdSRichard Lowe 38702941cdSRichard Lowe# By default, we build the shared library. Construction of the standalone 39702941cdSRichard Lowe# is specifically requested by architecture-specific Makefiles. 40702941cdSRichard LoweTYPES= library 41702941cdSRichard LoweCURTYPE= library 42702941cdSRichard Lowe 43702941cdSRichard LoweCOMDIR= $(SRC)/lib/libsaveargs/common 44702941cdSRichard Lowe 45702941cdSRichard LoweOBJECTS_common_amd64 = saveargs.o 46702941cdSRichard LoweSRCS_common_amd64 = $(OBJECTS_common_amd64:%.o=../amd64/%.c) 47702941cdSRichard Lowe 48702941cdSRichard LoweOBJECTS= $(OBJECTS_common_$(MACH)) $(OBJECTS_common_$(MACH64)) $(OBJECTS_common_common) 49702941cdSRichard Lowe 50702941cdSRichard Loweinclude $(SRC)/lib/Makefile.lib 51702941cdSRichard Lowe 52702941cdSRichard LoweSRCS= $(SRCS_common_$(MACH)) $(SRCS_common_$(MACH64)) $(SRC_common_common) 53702941cdSRichard Lowe 54702941cdSRichard Lowe# 55702941cdSRichard Lowe# Used to verify that the standalone doesn't have any unexpected external 56702941cdSRichard Lowe# dependencies. 57702941cdSRichard Lowe# 58702941cdSRichard LoweLINKTEST_OBJ = objs/linktest_stand.o 59702941cdSRichard Lowe 60702941cdSRichard LoweCLOBBERFILES_standalone = $(LINKTEST_OBJ) 61702941cdSRichard LoweCLOBBERFILES += $(CLOBBERFILES_$(CURTYPE)) 62702941cdSRichard Lowe 63702941cdSRichard LoweLIBS_standalone = $(STANDLIBRARY) 64702941cdSRichard LoweLIBS_library = $(DYNLIB) $(LINTLIB) 65702941cdSRichard LoweLIBS = $(LIBS_$(CURTYPE)) 66702941cdSRichard Lowe 67702941cdSRichard LoweMAPFILES = $(COMDIR)/mapfile-vers 68702941cdSRichard Lowe 69702941cdSRichard LoweLDLIBS += -lc -ldisasm 70702941cdSRichard Lowe 71702941cdSRichard LoweLDFLAGS_standalone = $(ZNOVERSION) $(BREDUCE) -dy -r 72702941cdSRichard LoweLDFLAGS = $(LDFLAGS_$(CURTYPE)) 73702941cdSRichard Lowe 74702941cdSRichard LoweASFLAGS_standalone = -DDIS_STANDALONE 75702941cdSRichard LoweASFLAGS_library = 76702941cdSRichard LoweASFLAGS += -P $(ASFLAGS_$(CURTYPE)) -D_ASM 77702941cdSRichard Lowe 78702941cdSRichard Lowe$(LINTLIB) := SRCS = $(COMDIR)/$(LINTSRC) 79702941cdSRichard Lowe 80702941cdSRichard Lowe# We want the thread-specific errno in the library, but we don't want it in 81702941cdSRichard Lowe# the standalone. $(DTS_ERRNO) is designed to add -D_TS_ERRNO to $(CPPFLAGS), 82702941cdSRichard Lowe# in order to enable this feature. Conveniently, -D_REENTRANT does the same 83702941cdSRichard Lowe# thing. As such, we null out $(DTS_ERRNO) to ensure that the standalone 84702941cdSRichard Lowe# doesn't get it. 85702941cdSRichard LoweDTS_ERRNO= 86702941cdSRichard Lowe 87702941cdSRichard LoweCPPFLAGS_standalone = -DDIS_STANDALONE 88702941cdSRichard LoweCPPFLAGS_library = -D_REENTRANT 89702941cdSRichard LoweCPPFLAGS += -I$(COMDIR) $(CPPFLAGS_$(CURTYPE)) 90702941cdSRichard Lowe 91702941cdSRichard LoweCFLAGS_standalone = $(STAND_FLAGS_32) 92702941cdSRichard LoweCFLAGS_common = 93702941cdSRichard LoweCFLAGS += $(CFLAGS_$(CURTYPE)) $(CFLAGS_common) 94702941cdSRichard Lowe 95702941cdSRichard LoweCFLAGS64_standalone = $(STAND_FLAGS_64) 96702941cdSRichard LoweCFLAGS64 += $(CCVERBOSE) $(CFLAGS64_$(CURTYPE)) $(CFLAGS64_common) 97702941cdSRichard Lowe 98702941cdSRichard LoweDYNFLAGS += $(ZINTERPOSE) 99702941cdSRichard Lowe 100702941cdSRichard Lowe.KEEP_STATE: 101