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 #
  23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 # Copyright (c) 2012, Joyent, Inc. All rights reserved.
  26 #
  27 
  28 .KEEP_STATE:
  29 .SUFFIXES:
  30 .SUFFIXES: .xml .xmlgen .xmlgenksh $(SUFFIXES)
  31 
  32 MODCLASS = maps
  33 
  34 include ../../../Makefile.lib
  35 include ../../../../Makefile.lib
  36 
  37 DTDSRC = $(DTDFILE:%=../common/%)
  38 DTDTARG = $(DTDFILE:%=%)
  39 ROOTDTDTARG = $(DTDTARG:%=$(ROOT)/usr/share/lib/xml/dtd/%)
  40 
  41 common_ROOTTOPOROOT = $(ROOT)/usr/lib/fm/topo/$(MODCLASS)
  42 arch_ROOTTOPOROOT = $(ROOT)/usr/platform/$(ARCH)/lib/fm/topo/$(MODCLASS)
  43 platform_ROOTTOPOROOT = \
  44         $(PLATFORMS:%=$(ROOT)/usr/platform/%/lib/fm/topo/$(MODCLASS))
  45 ROOTTOPOROOT = $($(CLASS)_ROOTTOPOROOT)
  46 ROOTTOPOMAPS = $(TOPOFILE:%=$(ROOTTOPOROOT)/%)
  47 
  48 install:= FILEMODE =    0444
  49 
  50 # The .xmlgen perl file automatically generates a new xml file.  This is done
  51 # to avoid having to deal with things like 48 platform specific internal
  52 # storage bays by hand.
  53 .xmlgen.xml:
  54         $(RM) $@ 
  55         $(CAT) ../common/xmlgen-header.xml > $@
  56         $(PERL) $< >> $@
  57 
  58 .xmlgenksh.xml:
  59         $(RM) $@
  60         $(CAT) ../common/xmlgen-header-new.xml > $@
  61         $(KSH93) $< >> $@
  62         
  63 %.xml: ../common/%.xml
  64         $(RM) $@
  65         $(CAT) $< > $@
  66 
  67 include ../../Makefile.rootdirs
  68 
  69 all: $(TOPOFILE)
  70 
  71 clean:
  72         $(RM) $(ROOTTOPOMAPS)
  73         $(RM) $(TEMPTOPOFILE)
  74 
  75 clobber: clean
  76 
  77 check: $(CHECKHDRS)
  78 
  79 install_h _msg:
  80 
  81 lint: $(TOPOFILE:%=%.chk)
  82 
  83 %.xml.chk: %.xml
  84         @echo xmllint $<
  85         @xmllint --dropdtd $< | \
  86         xmllint --noout --dtdvalid  $(DTDSRC) -
  87 
  88 $($(CLASS)_ROOTTOPOROOT)/%: %
  89         $(INS.file)
  90 
  91 $(ROOTDTDTARG): $$(@D)
  92         $(RM) $@; $(INS) -s -m 0444 -f $(@D) $(DTDSRC)
  93 
  94 install: all $(ROOTDTDTARG) $(ROOTTOPOROOT) $(ROOTTOPOMAPS)