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