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 src/CDDL.txt 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 src/CDDL.txt. 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 # 23 # Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 # Use is subject to license terms. 25 # 26 # ident "@(#)subdir.mk 1.36 08/06/04 SMI" 27 # 28 29 SUNMAKE = $(shell echo x | tr x \\043) 30 GNUMAKE:sh = echo \\043 31 32 PROTOFLAGS += \ 33 SRCROOT=$(SRCROOT) \ 34 PROTOTYPE=$(PROTOTYPE) \ 35 PROTODIR=$(PROTODIR:./%=%)/$@ \ 36 BLDDIR=$(BLDDIR)/$(@:tc_%=) 37 38 $(SUNMAKE)all all-% := TRGT = all 39 $(SUNMAKE)clean clean-% := TRGT = clean 40 $(SUNMAKE)clobber clobber-% := TRGT = clobber 41 $(SUNMAKE)lint lint-% := TRGT = lint 42 43 $(SUNMAKE)proto := TRGT = proto $(PROTOFLAGS) 44 $(SUNMAKE)cstyle := TRGT = cstyle 45 $(SUNMAKE)pkgproto := TRGT = pkgproto $(PROTOFLAGS) 46 47 $(GNUMAKE)all all-% := 48 $(GNUMAKE)all all-% : TRGT = all 49 $(GNUMAKE)clean clean-% := 50 $(GNUMAKE)clean clean-% : TRGT = clean 51 $(GNUMAKE)clobber clobber-% := 52 $(GNUMAKE)clobber clobber-% : TRGT = clobber 53 $(GNUMAKE)lint lint-% := 54 $(GNUMAKE)lint lint-% : TRGT = lint 55 56 $(GNUMAKE)proto := 57 $(GNUMAKE)proto : TRGT = proto $(PROTOFLAGS) 58 $(GNUMAKE)cstyle := 59 $(GNUMAKE)cstyle : TRGT = cstyle 60 $(GNUMAKE)pkgproto := 61 $(GNUMAKE)pkgproto : TRGT = pkgproto $(PROTOFLAGS) 62 63 all lint proto clobber clean cstyle : $(SUBDIRS) 64 65 $(SUBDIRS) : .FRC 66 @printf " %s " "$(MSPACE)" 67 cd $@; $(MAKE) MSPACE=">$(MSPACE)" $(TCARGS) $(TRGT) $($(TRGT)) 68 69 pkgproto : $(PKGFILES:%=pkgproto_%) $(SUBDIRS) 70 71 pkgproto_doc := CLASS = -c doc 72 pkgproto_%ds pkgproto_%csrc pkgproto_%include := CLASS = -c node 73 74 pkgproto_%bin : %bin 75 cd $(SRCROOT) ;\ 76 pkgproto $(PROTODIR)/$? | grep -v SCCS \ 77 | awk '{print $$1" "$$2" "$$3" 0555"}' >> $(PROTOTYPE) 78 79 pkgproto_%scripts : %scripts 80 cd $(SRCROOT) ;\ 81 pkgproto $(PROTODIR)/$?=$(PROTODIR)/bin | egrep -v "SCCS|bin "\ 82 | sed -e 's,.ksh=,=,g' -e 's,.pl=,=,g'\ 83 | awk '{print $$1" "$$2" "$$3" 0555"}' >> $(PROTOTYPE) 84 85 86 pkgproto_%bin := AWKARG = '{print $$1" "$$2" "$$3}' 87 pkgproto_% := AWKARG = '{print $$1" "$$2" "$$3" "$$4}' 88 89 pkgproto_% : % 90 cd $(SRCROOT);\ 91 pkgproto $(CLASS) $(PROTODIR)/$? | egrep -v "SCCS" \ 92 | awk $(AWKARG) >> $(PROTOTYPE) 93 94 .FRC : 95