17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
55aefb655Srie# Common Development and Distribution License (the "License").
65aefb655Srie# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
215aefb655Srie
227c478bd9Sstevel@tonic-gate#
23c6c9aed4Sab# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
261886f67eSGordon Ross# Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
27cf9a187cSAndy Fiddaman# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
285aefb655Srie#
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate%.o:		../common/%.c
315aefb655Srie		$(COMPILE.c) -o $@ $<
325aefb655Srie		$(POST_PROCESS_O)
335aefb655Srie
345aefb655Srie%32.o:		../common/%.c
355aefb655Srie		$(COMPILE.c) -o $@ $<
365aefb655Srie		$(POST_PROCESS_O)
375aefb655Srie
385aefb655Srie%64.o:		../common/%.c
395aefb655Srie		$(COMPILE.c) -D_ELF64 -o $@ $<
407c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
417c478bd9Sstevel@tonic-gate
4269b1fd3fSRichard Lowe%.o:		$(SGSCOMMON)/%.c
435aefb655Srie		$(COMPILE.c) -o $@ $<
447c478bd9Sstevel@tonic-gate		$(POST_PROCESS_O)
457c478bd9Sstevel@tonic-gate
461886f67eSGordon Rossall:		$(PROG)
47c6c9aed4Sab
481886f67eSGordon Ross$(PROG):	$(OBJS) $(MAPFILE) check_struct_layout
497c478bd9Sstevel@tonic-gate		$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
507c478bd9Sstevel@tonic-gate		$(POST_PROCESS)
517c478bd9Sstevel@tonic-gate
521886f67eSGordon Rosscheck_struct_layout: gen_struct_layout gen_layout_obj.o
531886f67eSGordon Ross	sed -e '/^#include <struct_layout.h>/q' \
541886f67eSGordon Ross	  ../common/struct_layout_$(ARCH).c | sed -e '$$d' \
551886f67eSGordon Ross	  > struct_layout_$(ARCH).tmp
561886f67eSGordon Ross	./gen_struct_layout gen_layout_obj.o $(ARCH) \
571886f67eSGordon Ross	  >> struct_layout_$(ARCH).tmp
58fc01d378SGordon Ross	@diff -u struct_layout_$(ARCH).tmp \
591886f67eSGordon Ross	  ../common/struct_layout_$(ARCH).c ||\
601886f67eSGordon Ross	{ echo "Error: struct_layout_$(ARCH).c needs update!" ; exit 1; }
61fc01d378SGordon Ross	touch $@
621886f67eSGordon Ross
631886f67eSGordon Ross# We need CTF data in this object.
641886f67eSGordon Rossgen_layout_obj.o := CFLAGS += $(CTF_FLAGS)
651886f67eSGordon Rossgen_layout_obj.o := CFLAGS64 += $(CTF_FLAGS)
661886f67eSGordon Rossgen_layout_obj.o := POST_PROCESS_O = $(CTFCONVERT_O)
671886f67eSGordon Ross
681886f67eSGordon Rossgen_struct_layout:	../common/gen_struct_layout.c
697f11fd00SRichard Lowe		$(NATIVECC) $(NATIVE_CFLAGS) -o $@ \
701886f67eSGordon Ross			../common/gen_struct_layout.c -lctf
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gateclean:
731886f67eSGordon Ross		$(RM) $(OBJS) $(CLEANFILES) gen_struct_layout \
741886f67eSGordon Ross		  check_struct_layout gen_layout_obj.o \
751886f67eSGordon Ross		  struct_layout_$(ARCH).tmp
767c478bd9Sstevel@tonic-gate
77*e9db39ceSRichard Loweinstall:        all $(ROOTPROG) $(ROOTCCSBINLINK)
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateinclude		$(SRC)/cmd/Makefile.targ
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate# Derived source and header files (messaging).
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gatecatalog:	$(BLTMESG)
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gatechkmsg:		$(SRCS)
867c478bd9Sstevel@tonic-gate		sh $(CHKMSG) $(CHKMSGFLAGS) $(SRCS)
877c478bd9Sstevel@tonic-gate
887c478bd9Sstevel@tonic-gate$(BLTDEFS) + \
897c478bd9Sstevel@tonic-gate$(BLTDATA) + \
907c478bd9Sstevel@tonic-gate$(BLTMESG):	$(SGSMSGALL)
917c478bd9Sstevel@tonic-gate		$(SGSMSG) $(SGSMSGFLAGS) $(SGSMSGALL)
92