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# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 23# 24# Definitions common to command source. 25# 26# include global definitions; SRC should be defined in the shell. 27# SRC is needed until RFE 1026993 is implemented. 28 29include $(SRC)/Makefile.master 30 31LN= ln 32SH= sh 33ECHO= echo 34MKDIR= mkdir 35TOUCH= touch 36 37FILEMODE= 0555 38LIBFILEMODE= 0444 39XPG4= $(XPG4PROG:%=%.xpg4) 40XPG6= $(XPG6PROG:%=%.xpg6) 41 42KRB5DIR= $(ROOT)/usr 43KRB5BIN= $(KRB5DIR)/bin 44KRB5SBIN= $(KRB5DIR)/sbin 45KRB5LIB= $(KRB5DIR)/lib/krb5 46KRB5RUNPATH= /usr/lib/krb5 47GSSRUNPATH= /usr/lib/gss 48 49 50ROOTBIN= $(ROOT)/usr/bin 51ROOTLIB= $(ROOT)/usr/lib 52ROOTLIBSVCBIN= $(ROOT)/lib/svc/bin 53ROOTLIBSVCMETHOD= $(ROOT)/lib/svc/method 54ROOTLIBXEN= $(ROOT)/usr/lib/xen/bin 55ROOTLIBZONES= $(ROOT)/lib/zones 56 57ROOTSHLIB= $(ROOT)/usr/share/lib 58ROOTPKGBIN= $(ROOT)/usr/sadm/install/bin 59ROOTCLASS_SCR_DIR= $(ROOT)/usr/sadm/install/scripts 60ROOTADMIN_SRC_DIR= $(ROOT)/var/sadm/install/admin 61 62ROOTSHLIBCCS= $(ROOTSHLIB)/ccs 63ROOTSBIN= $(ROOT)/sbin 64ROOTUSRSBIN= $(ROOT)/usr/sbin 65ROOTETC= $(ROOT)/etc 66 67ROOTETCSECURITY= $(ROOTETC)/security 68ROOTETCTSOL= $(ROOTETCSECURITY)/tsol 69ROOTETCSECLIB= $(ROOTETCSECURITY)/lib 70ROOTETCZONES= $(ROOTETC)/zones 71 72ROOTETCFTPD= $(ROOT)/etc/ftpd 73ROOTETCINET= $(ROOT)/etc/inet 74ROOTCCSBIN= $(ROOT)/usr/ccs/bin 75ROOTCCSBIN64= $(ROOTCCSBIN)/$(MACH64) 76ROOTCCSBINLINKDIR= $(ROOT)/../../bin 77ROOTCCSBINLINKDIR64= $(ROOT)../../../bin/$(MACH) 78ROOTCCSLIB= $(ROOT)/usr/ccs/lib 79ROOTUSRKVM= $(ROOT)/usr/kvm 80ROOTHAS= $(ROOT)/usr/has 81ROOTHASBIN= $(ROOT)/usr/has/bin 82ROOTHASLIB= $(ROOT)/usr/has/lib 83ROOTXPG4= $(ROOT)/usr/xpg4 84ROOTXPG4BIN= $(ROOT)/usr/xpg4/bin 85ROOTXPG4BIN32= $(ROOTXPG4BIN)/$(MACH32) 86ROOTXPG4BIN64= $(ROOTXPG4BIN)/$(MACH64) 87ROOTXPG6= $(ROOT)/usr/xpg6 88ROOTXPG6BIN= $(ROOT)/usr/xpg6/bin 89ROOTLOCALEDEF= $(ROOT)/usr/lib/localedef 90ROOTCHARMAP= $(ROOTLOCALEDEF)/charmap 91ROOTI18NEXT= $(ROOTLOCALEDEF)/extensions 92ROOTI18NEXT64= $(ROOTLOCALEDEF)/extensions/$(MACH64) 93ROOTBIN32= $(ROOTBIN)/$(MACH32) 94ROOTBIN64= $(ROOTBIN)/$(MACH64) 95ROOTCMDDIR64= $(ROOTCMDDIR)/$(MACH64) 96ROOTLIB64= $(ROOTLIB)/$(MACH64) 97ROOTUSRSBIN32= $(ROOTUSRSBIN)/$(MACH32) 98ROOTUSRSBIN64= $(ROOTUSRSBIN)/$(MACH64) 99ROOTVARSMB= $(ROOT)/var/smb 100 101 102# 103# Like ROOTLIBDIR in $(SRC)/Makefile.lib, any lower-level Makefiles that 104# put their binaries in a non-standard location should reset this and use 105# $(ROOTCMD) in their `install' target. By default we set this to a bogus 106# value so that it will not conflict with any of the other values already 107# defined in this Makefile. 108# 109ROOTCMDDIR= $(ROOT)/__nonexistent_directory__ 110 111ROOTSHAUDIO= $(ROOT)/usr/share/audio 112ROOTAUDIOSAMP= $(ROOTSHAUDIO)/samples 113ROOTAUDIOSAMPAU=$(ROOTAUDIOSAMP)/au 114 115ISAEXEC= $(ROOT)/usr/lib/isaexec 116PLATEXEC= $(ROOT)/usr/lib/platexec 117 118LDLIBS = $(LDLIBS.cmd) 119 120LDFLAGS.cmd = \ 121 $(BDIRECT) $(ENVLDFLAGS1) $(ENVLDFLAGS2) $(ENVLDFLAGS3) \ 122 $(MAPFILE.NES:%=-Wl,-M%) $(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%) 123 124LDFLAGS = $(LDFLAGS.cmd) 125 126KRB5PROG= $(PROG:%=$(KRB5BIN)/%) 127KRB5SBINPROG= $(PROG:%=$(KRB5SBIN)/%) 128KRB5LIBPROG= $(PROG:%=$(KRB5LIB)/%) 129 130ROOTPROG= $(PROG:%=$(ROOTBIN)/%) 131ROOTCMD= $(PROG:%=$(ROOTCMDDIR)/%) 132ROOTSHFILES= $(SHFILES:%=$(ROOTBIN)/%) 133ROOTLIBPROG= $(PROG:%=$(ROOTLIB)/%) 134ROOTLIBSHFILES= $(SHFILES:%=$(ROOTLIB)/%) 135ROOTSHLIBPROG= $(PROG:%=$(ROOTSHLIB)/%) 136ROOTSBINPROG= $(PROG:%=$(ROOTSBIN)/%) 137ROOTPKGBINPROG= $(PROG:%=$(ROOTPKGBIN)/%) 138ROOTCLASS_SCR_FILES= $(SCRIPTS:%=$(ROOTCLASS_SCR_DIR)/%) 139ROOTUSRSBINPROG=$(PROG:%=$(ROOTUSRSBIN)/%) 140ROOTUSRSBINSCRIPT=$(SCRIPT:%=$(ROOTUSRSBIN)/%) 141ROOTETCPROG= $(PROG:%=$(ROOTETC)/%) 142ROOTHASBINPROG= $(PROG:%=$(ROOTHASBIN)/%) 143ROOTHASLIBPROG= $(PROG:%=$(ROOTHASLIB)/%) 144ROOTCCSBINPROG= $(PROG:%=$(ROOTCCSBIN)/%) 145ROOTCCSBINPROG64= $(PROG:%=$(ROOTCCSBIN64)/%) 146ROOTCCSBINLINK=$(PROG:%= $(ROOTCCSBINLINKDIR)/%) 147ROOTCCSBINLINK64=$(PROG:%=$(ROOTCCSBINLINKDIR64)/%) 148ROOTUSRKVMPROG= $(PROG:%=$(ROOTUSRKVM)/%) 149ROOTXPG4PROG= $(XPG4PROG:%=$(ROOTXPG4BIN)/%) 150ROOTXPG4PROG32= $(XPG4PROG:%=$(ROOTXPG4BIN32)/%) 151ROOTXPG4PROG64= $(XPG4PROG:%=$(ROOTXPG4BIN64)/%) 152ROOTXPG6PROG= $(XPG6PROG:%=$(ROOTXPG6BIN)/%) 153ROOTLOCALEPROG= $(PROG:%=$(ROOTLOCALEDEF)/%) 154ROOTPROG64= $(PROG:%=$(ROOTBIN64)/%) 155ROOTPROG32= $(PROG:%=$(ROOTBIN32)/%) 156ROOTCMD64= $(PROG:%=$(ROOTCMDDIR64)/%) 157ROOTUSRSBINPROG32= $(PROG:%=$(ROOTUSRSBIN32)/%) 158ROOTUSRSBINPROG64= $(PROG:%=$(ROOTUSRSBIN64)/%) 159 160# Symlink rules for /usr/ccs/bin commands. Note, those commands under 161# the rule of the linker area, are controlled by a different set of 162# rules defined in $(SRC)/cmd/sgs/Makefile.var. 163 164INS.ccsbinlink= \ 165 $(RM) $(ROOTCCSBINPROG); \ 166 $(SYMLINK) ../../bin/$(PROG) $(ROOTCCSBINPROG) 167 168INS.ccsbinlink64= \ 169 $(RM) $(ROOTCCSBINPROG64); \ 170 $(SYMLINK) ../../../bin/$(MACH64)/$(PROG) $(ROOTCCSBINPROG64) 171 172ROOTETCDEFAULT= $(ROOTETC)/default 173ROOTETCDEFAULTFILES= $(DEFAULTFILES:%.dfl=$(ROOTETCDEFAULT)/%) 174$(ROOTETCDEFAULTFILES) := FILEMODE = 0644 175 176ROOTETCSECFILES= $(ETCSECFILES:%=$(ROOTETCSECURITY)/%) 177$(ROOTETCSECFILES) := FILEMODE = 0644 178 179ROOTETCTSOLFILES= $(ETCTSOLFILES:%=$(ROOTETCTSOL)/%) 180$(ROOTETCTSOLFILES) := FILEMODE = 0644 181 182ROOTETCSECLIBFILES= $(ETCSECLIBFILES:%=$(ROOTETCSECLIB)/%) 183 184ROOTETCZONESFILES= $(ETCZONESFILES:%=$(ROOTETCZONES)/%) 185$(ROOTETCZONESFILES) := FILEMODE = 0444 186 187ROOTLIBZONESFILES= $(LIBZONESFILES:%=$(ROOTLIBZONES)/%) 188$(ROOTLIBZONESFILES) := FILEMODE = 0555 189 190ROOTADMIN_SRC_FILE= $(ADMINFILE:%=$(ROOTADMIN_SRC_DIR)/%) 191$(ROOTADMIN_SRC_FILE) := FILEMODE = 0444 192 193# 194# Directories for smf(5) service manifests and profiles. 195# 196ROOTSVC= $(ROOT)/lib/svc 197ROOTETCSVC= $(ROOT)/etc/svc 198 199ROOTSVCMANIFEST= $(ROOTSVC)/manifest 200ROOTSVCPROFILE= $(ROOTETCSVC)/profile 201 202ROOTSVCMILESTONE= $(ROOTSVCMANIFEST)/milestone 203ROOTSVCDEVICE= $(ROOTSVCMANIFEST)/device 204ROOTSVCSYSTEM= $(ROOTSVCMANIFEST)/system 205ROOTSVCSYSTEMDEVICE= $(ROOTSVCSYSTEM)/device 206ROOTSVCSYSTEMFILESYSTEM= $(ROOTSVCSYSTEM)/filesystem 207ROOTSVCSYSTEMSECURITY= $(ROOTSVCSYSTEM)/security 208ROOTSVCNETWORK= $(ROOTSVCMANIFEST)/network 209ROOTSVCNETWORKDNS= $(ROOTSVCNETWORK)/dns 210ROOTSVCNETWORKISCSI= $(ROOTSVCNETWORK)/iscsi 211ROOTSVCNETWORKLDAP= $(ROOTSVCNETWORK)/ldap 212ROOTSVCNETWORKNFS= $(ROOTSVCNETWORK)/nfs 213ROOTSVCNETWORKNIS= $(ROOTSVCNETWORK)/nis 214ROOTSVCNETWORKROUTING= $(ROOTSVCNETWORK)/routing 215ROOTSVCNETWORKRPC= $(ROOTSVCNETWORK)/rpc 216ROOTSVCNETWORKSMB= $(ROOTSVCNETWORK)/smb 217ROOTSVCNETWORKSECURITY= $(ROOTSVCNETWORK)/security 218ROOTSVCNETWORKSSL= $(ROOTSVCNETWORK)/ssl 219ROOTSVCNETWORKIPSEC= $(ROOTSVCNETWORK)/ipsec 220ROOTSVCNETWORKSHARES= $(ROOTSVCNETWORK)/shares 221ROOTSVCSMB= $(ROOTSVCNETWORK)/smb 222ROOTSVCPLATFORM= $(ROOTSVCMANIFEST)/platform 223ROOTSVCPLATFORMSUN4U= $(ROOTSVCPLATFORM)/sun4u 224ROOTSVCPLATFORMSUN4V= $(ROOTSVCPLATFORM)/sun4v 225ROOTSVCAPPLICATION= $(ROOTSVCMANIFEST)/application 226ROOTSVCAPPLICATIONMANAGEMENT= $(ROOTSVCAPPLICATION)/management 227ROOTSVCAPPLICATIONSECURITY= $(ROOTSVCAPPLICATION)/security 228ROOTSVCAPPLICATIONPRINT= $(ROOTSVCAPPLICATION)/print 229 230# 231# Commands Makefiles delivering a manifest are expected to define MANIFEST. 232# 233# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a 234# subdirectory of the manifest directories listed above should reset 235# ROOTMANIFESTDIR and use it in their `install' target. By default we set this 236# to a bogus value so that it will not conflict with any of the other values 237# already defined in this Makefile. 238# 239# The manifest validation of the $SRC/cmd check target is also derived from a 240# valid MANIFEST setting. 241# 242ROOTMANIFESTDIR= $(ROOTSVCMANIFEST)/__nonexistent_directory__ 243ROOTMANIFEST= $(MANIFEST:%=$(ROOTMANIFESTDIR)/%) 244CHKMANIFEST= $(MANIFEST:%.xml=%.xmlchk) 245 246# Manifests cannot be checked in parallel, because we are using the global 247# repository that is in $(SRC)/cmd/svc/seed/global.db. This is a 248# repository that is built from the manifests in this workspace, whereas 249# the build machine's repository may be out of sync with these manifests. 250# Because we are using a private repository, svccfg-native must start up a 251# private copy of configd-native. We cannot have multiple copies of 252# configd-native trying to access global.db simultaneously. 253 254.NO_PARALLEL: $(CHKMANIFEST) 255 256# 257# For installing "starter scripts" of services 258# 259 260ROOTSVCMETHOD= $(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%) 261 262ROOTSVCBINDIR= $(ROOTLIBSVCBIN)/__nonexistent_directory__ 263ROOTSVCBIN= $(SVCBIN:%=$(ROOTSVCBINDIR)/%) 264 265# 266 267# For programs that are installed in the root filesystem, 268# build $(ROOTFS_PROG) rather than $(PROG) 269$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1 270 271$(KRB5BIN)/%: % 272 $(INS.file) 273 274$(KRB5SBIN)/%: % 275 $(INS.file) 276 277$(KRB5LIB)/%: % 278 $(INS.file) 279 280$(ROOTBIN)/%: % 281 $(INS.file) 282 283$(ROOTLIB)/%: % 284 $(INS.file) 285 286$(ROOTBIN64)/%: % 287 $(INS.file) 288 289$(ROOTLIB64)/%: % 290 $(INS.file) 291 292$(ROOTBIN32)/%: % 293 $(INS.file) 294 295$(ROOTSHLIB)/%: % 296 $(INS.file) 297 298$(ROOTPKGBIN)/%: % 299 $(INS.file) 300 301$(ROOTCLASS_SCR_DIR)/%: % 302 $(INS.file) 303 304$(ROOTADMIN_SRC_DIR)/%: % 305 $(INS.file) 306 307$(ROOTSBIN)/%: % 308 $(INS.file) 309 310$(ROOTUSRSBIN)/%: % 311 $(INS.file) 312 313$(ROOTUSRSBIN32)/%: % 314 $(INS.file) 315 316$(ROOTUSRSBIN64)/%: % 317 $(INS.file) 318 319$(ROOTETC)/%: % 320 $(INS.file) 321 322$(ROOTETCFTPD)/%: % 323 $(INS.file) 324 325$(ROOTETCINET)/%: % 326 $(INS.file) 327 328$(ROOTETCDEFAULT)/%: %.dfl 329 $(INS.rename) 330 331$(ROOTETCTSOL)/%: % 332 $(INS.file) 333 334$(ROOTETCSECLIB)/%: % 335 $(INS.file) 336 337$(ROOTETCZONES)/%: % 338 $(INS.file) 339 340$(ROOTLIBZONES)/%: % 341 $(INS.file) 342 343$(ROOTLIBXEN)/%: % 344 $(INS.file) 345 346$(ROOTHASBIN)/%: % 347 $(INS.file) 348 349$(ROOTHASLIB)/%: % 350 $(INS.file) 351 352$(ROOTUSRKVM)/%: % 353 $(INS.file) 354 355$(ROOTXPG4BIN)/%: %.xpg4 356 $(INS.rename) 357 358$(ROOTXPG4BIN32)/%: %.xpg4 359 $(INS.rename) 360 361$(ROOTXPG4BIN64)/%: %.xpg4 362 $(INS.rename) 363 364$(ROOTXPG6BIN)/%: %.xpg6 365 $(INS.rename) 366 367$(ROOTLOCALEDEF)/%: % 368 $(INS.file) 369 370$(ROOTCHARMAP)/%: % 371 $(INS.file) 372 373$(ROOTI18NEXT)/%: % 374 $(INS.file) 375 376$(ROOTI18NEXT64)/%: % 377 $(INS.file) 378 379$(ROOTLIBSVCMETHOD)/%: % 380 $(INS.file) 381 382$(ROOTLIBSVCBIN)/%: % 383 $(INS.file) 384 385$(ROOTSVCMILESTONE)/%: % 386 $(INS.file) 387 388$(ROOTSVCDEVICE)/%: % 389 $(INS.file) 390 391$(ROOTSVCSYSTEM)/%: % 392 $(INS.file) 393 394$(ROOTSVCSYSTEMDEVICE)/%: % 395 $(INS.file) 396 397$(ROOTSVCSYSTEMFILESYSTEM)/%: % 398 $(INS.file) 399 400$(ROOTSVCSYSTEMSECURITY)/%: % 401 $(INS.file) 402 403$(ROOTSVCNETWORK)/%: % 404 $(INS.file) 405 406$(ROOTSVCNETWORKLDAP)/%: % 407 $(INS.file) 408 409$(ROOTSVCNETWORKNFS)/%: % 410 $(INS.file) 411 412$(ROOTSVCNETWORKNIS)/%: % 413 $(INS.file) 414 415$(ROOTSVCNETWORKRPC)/%: % 416 $(INS.file) 417 418$(ROOTSVCNETWORKSECURITY)/%: % 419 $(INS.file) 420 421$(ROOTSVCNETWORKSSL)/%: % 422 $(INS.file) 423 424$(ROOTSVCNETWORKIPSEC)/%: % 425 $(INS.file) 426 427$(ROOTSVCNETWORKSHARES)/%: % 428 $(INS.file) 429 430$(ROOTSVCNETWORKSMB)/%: % 431 $(INS.file) 432 433$(ROOTSVCAPPLICATION)/%: % 434 $(INS.file) 435 436$(ROOTSVCAPPLICATIONMANAGEMENT)/%: % 437 $(INS.file) 438 439$(ROOTSVCAPPLICATIONSECURITY)/%: % 440 $(INS.file) 441 442$(ROOTSVCAPPLICATIONPRINT)/%: % 443 $(INS.file) 444 445$(ROOTSVCPLATFORM)/%: % 446 $(INS.file) 447 448$(ROOTSVCPLATFORMSUN4U)/%: % 449 $(INS.file) 450 451$(ROOTSVCPLATFORMSUN4V)/%: % 452 $(INS.file) 453 454# Install rule for gprof, yacc, and lex dependency files 455$(ROOTSHLIBCCS)/%: ../common/% 456 $(INS.file) 457 458$(ROOTCCSBINLINKDIR)/%: % 459 $(INS.ccsbinlink) 460 461$(ROOTCCSBINLINKDIR64)/%: % 462 $(INS.ccsbinlink64) 463 464$(ROOTVARSMB)/%: % 465 $(INS.file) 466 467# build rule for statically linked programs with single source file. 468%.static: %.c 469 $(LINK.c) -o $@ $< $(LDLIBS) 470 $(POST_PROCESS) 471 472%.xpg4: %.c 473 $(LINK.c) -o $@ $< $(LDLIBS) 474 $(POST_PROCESS) 475 476%.xpg6: %.c 477 $(LINK.c) -o $@ $< $(LDLIBS) 478 $(POST_PROCESS) 479 480# Define the majority text domain in this directory. 481TEXT_DOMAIN= SUNW_OST_OSCMD 482 483CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE) 484 485# This flag is for programs which should not build a 32-bit binary 486sparc_64ONLY= $(POUND_SIGN) 48764ONLY= $($(MACH)_64ONLY) 488