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 238ROOTSVCNETWORKLDAP= $(ROOTSVCNETWORK)/ldap 239ROOTSVCNETWORKNFS= $(ROOTSVCNETWORK)/nfs 240ROOTSVCNETWORKNIS= $(ROOTSVCNETWORK)/nis 241ROOTSVCNETWORKROUTING= $(ROOTSVCNETWORK)/routing 242ROOTSVCNETWORKRPC= $(ROOTSVCNETWORK)/rpc 243ROOTSVCNETWORKSMB= $(ROOTSVCNETWORK)/smb 244ROOTSVCNETWORKSECURITY= $(ROOTSVCNETWORK)/security 245ROOTSVCNETWORKSSL= $(ROOTSVCNETWORK)/ssl 246ROOTSVCNETWORKIPSEC= $(ROOTSVCNETWORK)/ipsec 247ROOTSVCNETWORKSHARES= $(ROOTSVCNETWORK)/shares 248ROOTSVCSMB= $(ROOTSVCNETWORK)/smb 249ROOTSVCPLATFORM= $(ROOTVARSVCMANIFEST)/platform 250ROOTSVCPLATFORMSUN4U= $(ROOTSVCPLATFORM)/sun4u 251ROOTSVCPLATFORMSUN4V= $(ROOTSVCPLATFORM)/sun4v 252ROOTSVCAPPLICATION= $(ROOTVARSVCMANIFEST)/application 253ROOTSVCAPPLICATIONMANAGEMENT= $(ROOTSVCAPPLICATION)/management 254ROOTSVCAPPLICATIONSECURITY= $(ROOTSVCAPPLICATION)/security 255ROOTSVCAPPLICATIONPRINT= $(ROOTSVCAPPLICATION)/print 256 257# 258# Commands Makefiles delivering a manifest are expected to define MANIFEST. 259# 260# Like ROOTCMDDIR, any lower-level Makefiles that put their manifests in a 261# subdirectory of the manifest directories listed above should reset 262# ROOTMANIFESTDIR and use it in their `install' target. By default we set this 263# to a bogus value so that it will not conflict with any of the other values 264# already defined in this Makefile. 265# 266# The manifest validation of the $SRC/cmd check target is also derived from a 267# valid MANIFEST setting. 268# 269ROOTMANIFESTDIR= $(ROOTVARSVCMANIFEST)/__nonexistent_directory__ 270ROOTMANIFEST= $(MANIFEST:%=$(ROOTMANIFESTDIR)/%) 271CHKMANIFEST= $(MANIFEST:%.xml=%.xmlchk) 272 273# Manifests cannot be checked in parallel, because we are using the global 274# repository that is in $(SRC)/cmd/svc/seed/global.db. This is a 275# repository that is built from the manifests in this workspace, whereas 276# the build machine's repository may be out of sync with these manifests. 277# Because we are using a private repository, svccfg-native must start up a 278# private copy of configd-native. We cannot have multiple copies of 279# configd-native trying to access global.db simultaneously. 280 281.NO_PARALLEL: $(CHKMANIFEST) 282 283# 284# For installing "starter scripts" of services 285# 286 287ROOTSVCMETHOD= $(SVCMETHOD:%=$(ROOTLIBSVCMETHOD)/%) 288 289ROOTSVCBINDIR= $(ROOTLIBSVCBIN)/__nonexistent_directory__ 290ROOTSVCBIN= $(SVCBIN:%=$(ROOTSVCBINDIR)/%) 291 292# 293 294# For programs that are installed in the root filesystem, 295# build $(ROOTFS_PROG) rather than $(PROG) 296$(ROOTFS_PROG) := LDFLAGS += -Wl,-I/lib/ld.so.1 297 298$(KRB5BIN)/%: % 299 $(INS.file) 300 301$(KRB5SBIN)/%: % 302 $(INS.file) 303 304$(KRB5LIB)/%: % 305 $(INS.file) 306 307$(ROOTBIN)/%: % 308 $(INS.file) 309 310$(ROOTLIB)/%: % 311 $(INS.file) 312 313$(ROOTBIN64)/%: % 314 $(INS.file) 315 316$(ROOTLIB64)/%: % 317 $(INS.file) 318 319$(ROOTBIN32)/%: % 320 $(INS.file) 321 322$(ROOTSHLIB)/%: % 323 $(INS.file) 324 325$(ROOTSBIN)/%: % 326 $(INS.file) 327 328$(ROOTUSRSBIN)/%: % 329 $(INS.file) 330 331$(ROOTUSRSBIN32)/%: % 332 $(INS.file) 333 334$(ROOTUSRSBIN64)/%: % 335 $(INS.file) 336 337$(ROOTETC)/%: % 338 $(INS.file) 339 340$(ROOTETCDEFAULT)/%: %.dfl 341 $(INS.rename) 342 343$(ROOTETCTSOL)/%: % 344 $(INS.file) 345 346$(ROOTETCSECLIB)/%: % 347 $(INS.file) 348 349$(ROOTETCZONES)/%: % 350 $(INS.file) 351 352$(ROOTLIBZONES)/%: % 353 $(INS.file) 354 355$(ROOTLIBXEN)/%: % 356 $(INS.file) 357 358$(ROOTUSRKVM)/%: % 359 $(INS.file) 360 361$(ROOTXPG4BIN)/%: %.xpg4 362 $(INS.rename) 363 364$(ROOTXPG4BIN32)/%: %.xpg4 365 $(INS.rename) 366 367$(ROOTXPG4BIN64)/%: %.xpg4 368 $(INS.rename) 369 370$(ROOTXPG6BIN)/%: %.xpg6 371 $(INS.rename) 372 373$(ROOTLOCALEDEF)/%: % 374 $(INS.file) 375 376$(ROOTCHARMAP)/%: % 377 $(INS.file) 378 379$(ROOTI18NEXT)/%: % 380 $(INS.file) 381 382$(ROOTI18NEXT64)/%: % 383 $(INS.file) 384 385$(ROOTLIBSVCMETHOD)/%: % 386 $(INS.file) 387 388$(ROOTLIBSVCBIN)/%: % 389 $(INS.file) 390 391$(ROOTSVCMILESTONE)/%: % 392 $(INS.file) 393 394$(ROOTSVCDEVICE)/%: % 395 $(INS.file) 396 397$(ROOTSVCSYSTEM)/%: % 398 $(INS.file) 399 400$(ROOTSVCSYSTEMDEVICE)/%: % 401 $(INS.file) 402 403$(ROOTSVCSYSTEMFILESYSTEM)/%: % 404 $(INS.file) 405 406$(ROOTSVCSYSTEMSECURITY)/%: % 407 $(INS.file) 408 409$(ROOTSVCNETWORK)/%: % 410 $(INS.file) 411 412$(ROOTSVCNETWORKLDAP)/%: % 413 $(INS.file) 414 415$(ROOTSVCNETWORKNFS)/%: % 416 $(INS.file) 417 418$(ROOTSVCNETWORKNIS)/%: % 419 $(INS.file) 420 421$(ROOTSVCNETWORKRPC)/%: % 422 $(INS.file) 423 424$(ROOTSVCNETWORKSECURITY)/%: % 425 $(INS.file) 426 427$(ROOTSVCNETWORKSSL)/%: % 428 $(INS.file) 429 430$(ROOTSVCNETWORKIPSEC)/%: % 431 $(INS.file) 432 433$(ROOTSVCNETWORKSHARES)/%: % 434 $(INS.file) 435 436$(ROOTSVCNETWORKSMB)/%: % 437 $(INS.file) 438 439$(ROOTSVCAPPLICATION)/%: % 440 $(INS.file) 441 442$(ROOTSVCAPPLICATIONMANAGEMENT)/%: % 443 $(INS.file) 444 445$(ROOTSVCAPPLICATIONSECURITY)/%: % 446 $(INS.file) 447 448$(ROOTSVCAPPLICATIONPRINT)/%: % 449 $(INS.file) 450 451$(ROOTSVCPLATFORM)/%: % 452 $(INS.file) 453 454$(ROOTSVCPLATFORMSUN4U)/%: % 455 $(INS.file) 456 457$(ROOTSVCPLATFORMSUN4V)/%: % 458 $(INS.file) 459 460# Install rule for gprof, yacc, and lex dependency files 461$(ROOTSHLIBCCS)/%: ../common/% 462 $(INS.file) 463 464$(ROOTCCSBINLINKDIR)/%: % 465 $(INS.ccsbinlink) 466 467$(ROOTCCSBINLINKDIR64)/%: % 468 $(INS.ccsbinlink64) 469 470$(ROOTMAN1)/%: %.sunman 471 $(INS.rename) 472 473$(ROOTMAN1M)/%: %.sunman 474 $(INS.rename) 475 476$(ROOTMAN3)/%: %.sunman 477 $(INS.rename) 478 479$(ROOTVARSMB)/%: % 480 $(INS.file) 481 482# build rule for statically linked programs with single source file. 483%.static: %.c 484 $(LINK.c) -o $@ $< $(LDLIBS) 485 $(POST_PROCESS) 486 487%.xpg4: %.c 488 $(LINK.c) -o $@ $< $(LDLIBS) 489 $(POST_PROCESS) 490 491%.xpg6: %.c 492 $(LINK.c) -o $@ $< $(LDLIBS) 493 $(POST_PROCESS) 494 495# Define the majority text domain in this directory. 496TEXT_DOMAIN= SUNW_OST_OSCMD 497 498CLOBBERFILES += $(XPG4) $(XPG6) $(DCFILE) 499 500# This flag is being added only for SCO (x86) compatibility 501i386_SPFLAG= -D_iBCS2 502sparc_SPFLAG= 503 504iBCS2FLAG = $($(MACH)_SPFLAG) 505 506# This flag is for programs which should not build a 32-bit binary 507sparc_64ONLY= $(POUND_SIGN) 50864ONLY= $($(MACH)_64ONLY) 509