Makefile revision bb25c06cca41ca78e5fb87fbb8e81d55beb18c95
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater# CDDL HEADER START
a7038d1a0513c8e804937ebc95fc9cb3a46c04f5Mark Andrews#
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# The contents of this file are subject to the terms of the
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater# Common Development and Distribution License (the "License").
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# You may not use this file except in compliance with the License.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# or http://www.opensolaris.org/os/licensing.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# See the License for the specific language governing permissions
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# and limitations under the License.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews#
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# When distributing Covered Code, include this CDDL HEADER in each
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# fields enclosed by brackets "[]" replaced with your own identifying
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# information: Portions Copyright [yyyy] [name of copyright owner]
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews#
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# CDDL HEADER END
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
29747dfe5e073a299b3681e01f5c55540f8bfed7Mark Andrews# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein# Use is subject to license terms.
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# ident "%Z%%M% %I% %E% SMI"
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# This makefile drives the production of /unix (and unix.o).
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# sun4u implementation architecture dependent
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# Path to the base of the uts directory tree (usually /usr/src/uts).
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas GustafssonUTSBASE = ../..
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews# Define the module and object file sets.
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsUNIX = unix
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsOBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson $(CORE_OBJS:%=$(OBJS_DIR)/%) \
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsLINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson $(LINTS_DIR)/vers.ln \
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein $(LINTS_DIR)/modstubs.ln
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsUNIX32_LINK = $(ROOT_PSM_KERN_DIR_32)/$(UNIX)
ab023a65562e62b85a824509d829b6fad87e00b1Rob AusteinUNIX_BIN = $(OBJS_DIR)/$(UNIX)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsKRTLD_32 = misc/krtld
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsKRTLD_64 = misc/$(SUBDIR64)/krtld
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsKRTLD = $(KRTLD_$(CLASS))
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsLIBS = $(GENLIB) $(PLATLIB) $(CPULIB)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsGENUNIX = genunix
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsGENUNIX_DIR = ../$(GENUNIX)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsGENOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsCPU_DIR = .
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsCPUOPTS = -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsPLAT_DIR = ../platmod
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsPLATOPTS = -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
ab023a65562e62b85a824509d829b6fad87e00b1Rob AusteinLIBOPTS = $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsCTFEXTRAOBJS = $(OBJS_DIR)/vers.o
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews# Include common rules.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrewsinclude $(UTSBASE)/sun4u/Makefile.sun4u
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews# Define targets
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
ab023a65562e62b85a824509d829b6fad87e00b1Rob AusteinALL_TARGET = $(UNIX_BIN)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsLINT_TARGET = $(LINT_LIB)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark AndrewsINSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews# This is UNIX_DIR. Use a short path.
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
ab023a65562e62b85a824509d829b6fad87e00b1Rob AusteinUNIX_DIR = .
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews# Overrides
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews#
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark AndrewsCLEANFILES += $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews $(OBJS_DIR)/vers.o $(CPU_OBJ) $(CPULIB) \
b9efcf0a377381b29960137e54ecaf4db85a35c8Mark Andrews $(DTRACESTUBS_O) $(DTRACESTUBS)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark AndrewsCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN)
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark AndrewsCLEANLINTFILES += $(LINT_LIB)
a76b380643a22f23a67a9df284e86cd7ef7608c1Mark Andrews
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# lint pass one enforcement
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson# Turn on doubleword alignment for 64 bit counter timer registers
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas GustafssonCFLAGS += $(CCVERBOSE) -dalign
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson# For now, disable these lint checks; maintainers should endeavor
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson# to investigate and remove these for maximum lint coverage.
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson# Please do not carry these forward to new Makefiles.
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson#
233085a7d2b040eda2512f9014bcea58af220aa2Andreas GustafssonLINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas GustafssonLINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN
f621719829356f27e831507b75e88e8a655e48d8Danny MayerLINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
233085a7d2b040eda2512f9014bcea58af220aa2Andreas GustafssonLINTTAGS += -erroff=E_STATIC_UNUSED
ab023a65562e62b85a824509d829b6fad87e00b1Rob AusteinLINTTAGS += -erroff=E_PTRDIFF_OVERFLOW
d0aebc5a55b6145297d94f8aee939852357c59fcMark AndrewsLINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
d0aebc5a55b6145297d94f8aee939852357c59fcMark Andrews
d0aebc5a55b6145297d94f8aee939852357c59fcMark Andrews#
d0aebc5a55b6145297d94f8aee939852357c59fcMark Andrews# Default build targets.
d0aebc5a55b6145297d94f8aee939852357c59fcMark Andrews#
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein.KEEP_STATE:
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafssondef: $(DEF_DEPS)
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafssonall: $(ALL_DEPS)
f621719829356f27e831507b75e88e8a655e48d8Danny Mayer
74f261bd2b7846d8e730ca3a1b28d6503de5c74aMark Andrewsclean: $(CLEAN_DEPS)
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeinclobber: $(CLOBBER_DEPS)
2883651930dc85cacae940fe2a81277dfc14807dBrian Wellington
2883651930dc85cacae940fe2a81277dfc14807dBrian Wellingtonlint: $(LINT_DEPS)
2883651930dc85cacae940fe2a81277dfc14807dBrian Wellington
e61793f0865117ad87a19d6e245bea8f3b712d1bDanny Mayerclean.lint: $(CLEAN_LINT_DEPS)
2883651930dc85cacae940fe2a81277dfc14807dBrian Wellington
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeininstall: $(INSTALL_DEPS)
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) $(DTRACESTUBS)
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson $(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \
233085a7d2b040eda2512f9014bcea58af220aa2Andreas Gustafsson $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
e61793f0865117ad87a19d6e245bea8f3b712d1bDanny Mayer $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson $(POST_PROCESS)
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
531eafa3026663020f4a2ac5587cce44341e3442Andreas Gustafsson$(UNIX32_LINK): $(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
531eafa3026663020f4a2ac5587cce44341e3442Andreas Gustafsson -$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
f621719829356f27e831507b75e88e8a655e48d8Danny Mayer
531eafa3026663020f4a2ac5587cce44341e3442Andreas Gustafssonsymcheck: $(UNIX_O) $(MODSTUBS_O) $(LIBS)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson $(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson#$(UNIX).glom: $(UNIX)
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews# ${LD} -dy -b -z nodefs -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews# $(UNIX_O) $(MODSTUBS_O) $(GENUNIX_DIR)/$(GENUNIX)
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein# $(POST_PROCESS)
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews# Special rules for generating assym.h for inclusion in assembly files.
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews#
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews$(DSF_DIR)/$(OBJS_DIR)/assym.h: FRC
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews @cd $(DSF_DIR); $(MAKE) all.targ
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews$(GENLIB): FRC
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews @(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ)
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews @pwd
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews$(PLATLIB):
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews ?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ)
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein ?@pwd
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews#
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews# CPU_OBJ now comprises of 2 object files which come from sun4 common
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews# and from architecture dependent code. OBJS_DIR is prepended where
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein# CPU_OBJ is defined to allow for building multiple CPU_OBJ's
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews#
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews$(CPULIB): $(CPU_OBJ)
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews $(BUILD.SO) $(CPU_OBJ)
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews#
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews# The global lint target builds the kernel lint library (llib-lunix.ln)
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews# which is equivalent to a lint of /unix.o. Then all kernel modules for
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews# this architecture are linted against the kernel lint library.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews# Note: lint errors in the kernel lint library will be repeated for
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews# each module. It is important that the kernel lint library
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews# be clean to keep the textual output to a reasonable level.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS)
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews @-$(ECHO) "\n$(UNIX): (library construction):"
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews @$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein @$(MV) $(@F) $@
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrewslintlib: $(LINT_DEPS)
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews# Include common targets.
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrews#
ed03e26c44347ec20aff6608de6082e3594d95fbMark Andrewsinclude $(UTSBASE)/sun4u/Makefile.targ
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
9aba20edee4e704433a464ae43b070b0775de506Mark Andrews