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