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