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