xref: /titanic_51/usr/src/cmd/sgs/packages/Makefile (revision 4e942d8cd27c7f8bb80549d7c2564445f19ba4a3)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29include		$(SRC)/Makefile.master
30include		$(SRC)/cmd/sgs/Makefile.var
31
32EXTBUILD:sh=	if [ ! -h ../ext -a ! -d ../ext ]; \
33		then /bin/sh setup_pkg_ext .. ; \
34		fi
35
36BUILDLOG=	package_build.$(MACH).log
37
38MACHS:sh=	if [ "$MACH" = "sparc" ]; \
39		then echo "sparc sparcv9"; \
40		elif [ "$MACH" = "i386" ]; \
41		then echo "i386 amd64"; \
42		else echo "unknown"; \
43		fi
44
45RDBDIRS=	$(MACHS:%=../librtld_db/rdb_demo/%)
46LDMAKEDIRS=	$(MACHS:%=../libldmake/%)
47
48
49SUBDIRS1=	../libconv \
50		.WAIT \
51	 	../libdl \
52		.WAIT \
53		../libelf \
54		.WAIT \
55		../liblddbg \
56		../librtld_db \
57		.WAIT \
58		../librtld \
59		../libcrle
60
61SUBDIRS2 =	../rtld \
62		../rtld.4.x \
63		../libldstab \
64		../lari \
65		../ldprof \
66		../lddstub \
67		$(LDMAKEDIRS) \
68		../0@0 \
69		../tools \
70		$(RDBDIRS)
71
72
73PKGDIRS_EXT:sh=	if [ -f ../ext/packages/pkgdirs ]; \
74				then cat ../ext/packages/pkgdirs; \
75			fi
76
77#
78# Package dirs are directories which specifically
79# have a 'package' target.  This target is used to key
80# off of whether a system build is performed
81# or a SUNWonld build.
82#
83PKGDIRS=	../libcrle \
84		../libld \
85		../elfdump \
86		../crle \
87		../dump \
88		../lari \
89		../ld \
90		../ldd \
91		../ldprof \
92		../nm \
93		../mcs \
94		../moe \
95		../pvs $(PKGDIRS_EXT)
96
97$(SUBDIRS1) $(SUBDIRS2) :=	TARGET = install
98$(PKGDIRS) :=	TARGET = package
99
100
101M32:sh=		if [ "$MACH" = "sparc" ]; \
102			then echo sparc; \
103		elif [ "$MACH" = "i386" ]; \
104			then echo "$(VAR_I386_ARCH)"; \
105		else \
106			echo "unknown"; \
107		fi
108
109../%:		FRC
110		@ cd $@; pwd; $(MAKE) $(TARGET)
111
112.KEEP_STATE_FILE: .make.state.$(MACH)
113.KEEP_STATE:
114.PARALLEL:	$(SUBDIRS1) $(PKGDIRS) $(SUBDIRS2)
115
116all clean clobber install: FRC
117		@ cd $(MACH); pwd; $(MAKE) $@
118
119#
120# invoke `package' to build this package from scratch.  It will
121# perform make install in the directories that contains components
122# that this package is dependent upon
123#
124package:	FRC
125	@/bin/time $(MAKE) package_build 2>&1 | tee $(BUILDLOG)
126	@ echo "===BUILD COMPLETED  checking for warnings...==="
127	@ grep -i "warning:" $(BUILDLOG) | grep -v PSTAMP | cat
128	@ echo "==================done========================="
129
130package_build:	package_dep .WAIT package_chkmsg .WAIT install
131
132package_chkmsg:	FRC
133		@ cd ..; pwd; $(MAKE) chkmsg
134
135package_dep:	package_dep_ .WAIT $(SUBDIRS1) .WAIT \
136	$(PKGDIRS) .WAIT $(SUBDIRS2)
137
138package_dep_:	FRC
139		@ cd ../tools; pwd; $(MAKE) proto && ./proto
140		@ cd $(SRC)/head; pwd; $(MAKE) \
141			$(ROOT)/usr/include/dlfcn.h \
142			$(ROOT)/usr/include/gelf.h \
143			$(ROOT)/usr/include/libelf.h \
144			$(ROOT)/usr/include/proc_service.h \
145			$(ROOT)/usr/include/rtld_db.h \
146			$(ROOT)/usr/include/link.h
147		@ cd $(SRC)/lib/libproc; pwd; $(MAKE) install_h
148		@ cd $(SRC)/uts/common/sys; pwd; $(MAKE) \
149			$(ROOT)/usr/include/sys/elf.h \
150			$(ROOT)/usr/include/sys/elf_386.h \
151			$(ROOT)/usr/include/sys/elf_SPARC.h \
152			$(ROOT)/usr/include/sys/elf_notes.h \
153			$(ROOT)/usr/include/sys/elf_amd64.h \
154			$(ROOT)/usr/include/sys/elftypes.h \
155			$(ROOT)/usr/include/sys/auxv.h \
156			$(ROOT)/usr/include/sys/auxv_SPARC.h \
157			$(ROOT)/usr/include/sys/auxv_386.h \
158			$(ROOT)/usr/include/sys/link.h \
159			$(ROOT)/usr/include/sys/note.h \
160			$(ROOT)/usr/include/sys/systeminfo.h
161		@ cd $(SRC)/uts/$(M32)/sys; pwd; $(MAKE) \
162			$(ROOT)/usr/include/sys/machelf.h
163		@ cd ../tools/$(MACH); pwd; $(MAKE) sgsmsg piglatin
164		@ cd ..; pwd; $(MAKE) _msg_sgsmsg
165		@ cd ..; pwd; $(MAKE) native-add
166		@ cd ../libconv; pwd; $(MAKE) all
167		@ cd ../link_audit; pwd; $(MAKE) package
168		@ cd ../messages/$(MACH); pwd; $(MAKE) test
169		@ cd ../sgsdemangler; pwd; $(MAKE) all
170
171lint: FRC
172	$(MAKE) -f Makefile.lint lint
173
174FRC:
175