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 2007 Sun Microsystems, Inc.  All rights reserved.
  23 # Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 
  27 ROOTTERMINFO = $(ROOTSHLIB)/terminfo
  28 
  29 $(PROG).core: $(OBJS) $(KMDBLIBS) $(MAPFILE)
  30         $(LD) -r $(BREDUCE) $(ZNOVERSION) $(ZDEFS) -M$(MAPFILE) -o $@ $(OBJS) \
  31             $(KMDBLIBS)
  32 
  33 $(PROG): $(PROG).core $(KCTLOBJS)
  34         $(LD) -dy -r -o $@ $@.core -Nmisc/ctf $(KCTLOBJS)
  35         $(CTFMERGE) -L VERSION -o $@ $(OBJS) $(KCTLOBJS)
  36         $(KMDB_FPTEST)
  37         $(POST_PROCESS)
  38         $(SETDYNFLAG) -f DF_1_IGNMULDEF,DF_1_NOKSYMS $@
  39 
  40 clean.lint:
  41         $(RM) $(ALLLINTFILES)
  42 
  43 clean:
  44         $(RM) $(OBJS) $(KCTLOBJS) $(PROG).core $(MAPFILE)
  45         $(RM) $(MAPFILE_INTERMEDIATE)
  46         $(RM) kmdb_terminfo.c kmdb_modlinktest.c kmdb_modlinktest.o
  47         $(RM) kaif_off.h kmdb_context_off.h
  48         $(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
  49 
  50 clobber: clean clean.lint
  51         $(RM) $(PROG)
  52 
  53 dmods:
  54 
  55 #
  56 # Specialized object construction
  57 #
  58 kmdb_terminfo.c:        ../../../common/mdb/mdb_termio.c \
  59                         ../../../common/kmdb/kmdb_terminfo_skel.c \
  60                         $(ROOTTERMINFO)
  61         TERMINFO=$(ROOTTERMINFO) $(TIGEN) -s \
  62             ../../../common/kmdb/kmdb_terminfo_skel.c \
  63             -t ../../../common/mdb/mdb_termio.c \
  64             $(SUPPORTED_TERMS) > $@
  65 
  66 $(MAPFILE_INTERMEDIATE): $(MAPFILE_SOURCES) $(MAPFILE_TEMPLATE)
  67         $(HDR2MAP) -t $(MAPFILE_TEMPLATE) $(MAPFILE_SOURCES) >$@
  68 
  69 $(MAPFILE): $(MAPFILE_INTERMEDIATE)
  70         $(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$@
  71 
  72 mdb_lex.c: ../../../common/mdb/mdb_lex.l mdb_grammar.h
  73         $(LEX) $(LFLAGS) ../../../common/mdb/mdb_lex.l > $@
  74 
  75 mdb_grammar.h mdb_grammar.c: ../../../common/mdb/mdb_grammar.y
  76         $(YACC) $(YFLAGS) ../../../common/mdb/mdb_grammar.y
  77         @$(MV) y.tab.h mdb_grammar.h
  78         @$(MV) y.tab.c mdb_grammar.c
  79 
  80 #
  81 # These should really be combined into a dynamic rule, but there's a bug in
  82 # dmake that'll cause it to get confused about dependencies if we do.
  83 #
  84 
  85 kaif_off.h := CPPFLAGS += $(SACPPCFLAGS)
  86 
  87 kmdb_modlinktest.c: $(MAPFILE_INTERMEDIATE)
  88         $(MAP2LINKTEST) <$(MAPFILE_INTERMEDIATE) >$@
  89         $(CPP) -P $(SACPPFLAGS) <$(MAPFILE_INTERMEDIATE) >$(MAPFILE)
  90 
  91 #
  92 # Dynamic rules for object construction
  93 #
  94 %.o: ../../../common/kmdb/%.c
  95         $(COMPILE.c) -o $@ $<
  96         $(CTFCONVERT_O)
  97 
  98 %.o: ../../../common/kmdb/kctl/%.c
  99         $(COMPILE.c) -o $@ $<
 100         $(CTFCONVERT_O)
 101 
 102 %.o: ../../../common/kmdb/kctl/%.s
 103         $(COMPILE.s) -o $@ $<
 104 
 105 %.o: ../../../common/mdb/%.c
 106         $(COMPILE.c) -o $@ $<
 107         $(CTFCONVERT_O)
 108 
 109 %.o: ../../kmdb/%.c
 110         $(COMPILE.c) -o $@ $<
 111         $(CTFCONVERT_O)
 112 
 113 %.o: ../../kmdb/%.s
 114         $(COMPILE.s) -o $@ $<
 115 
 116 %.o: ../../kmdb/kctl/%.c
 117         $(COMPILE.c) -o $@ $<
 118         $(CTFCONVERT_O)
 119 
 120 %.o: ../../kmdb/kctl/%.s
 121         $(COMPILE.s) -o $@ $<
 122 
 123 %.o: ../../mdb/%.c
 124         $(COMPILE.c) -o $@ $<
 125         $(CTFCONVERT_O)
 126 
 127 %.o: %.c
 128         $(COMPILE.c) -o $@ $<
 129         $(CTFCONVERT_O)
 130 
 131 %.o: %.s
 132         $(COMPILE.s) -o $@ $<
 133 
 134 %.o: kctl/%.s
 135         $(COMPILE.s) -o $@ $<
 136 
 137 %.o: $(SRC)/common/list/%.c
 138         $(COMPILE.c) $<
 139         $(CTFCONVERT_O)
 140 
 141 %.o: $(SRC)/common/net/util/%.c
 142         $(COMPILE.c) $<
 143         $(CTFCONVERT_O)
 144 
 145 %.o: $(SRC)/common/util/%.c
 146         $(COMPILE.c) $<
 147         $(CTFCONVERT_O)
 148 
 149 #
 150 # Lint
 151 #
 152 
 153 %.ln: ../../../common/kmdb/%.c
 154         $(LINT.c) -c $<
 155 
 156 %.ln: ../../../common/kmdb/kctl/%.c
 157         $(LINT.c) -c $<
 158 
 159 %.ln: ../../../common/kmdb/kctl/%.s
 160         $(LINT.s) -c $<
 161 
 162 %.ln: ../../../common/mdb/%.c
 163         $(LINT.c) -c $<
 164 
 165 %.ln: ../../kmdb/%.c
 166         $(LINT.c) -c $<
 167 
 168 %.ln: ../../kmdb/%.s
 169         $(LINT.s) -c $<
 170 
 171 %.ln: ../../kmdb/kctl/%.c
 172         $(LINT.c) -c $<
 173 
 174 %.ln: ../../kmdb/kctl/%.s
 175         $(LINT.s) -c $<
 176 
 177 %.ln: ../../mdb/%.c
 178         $(LINT.c) -c $<
 179 
 180 %.ln: %.c
 181         $(LINT.c) -c $<
 182 
 183 %.ln: %.s
 184         $(LINT.s) -c $<
 185 
 186 %.ln: kctl/%.s
 187         $(LINT.s) -c $<
 188 
 189 %.ln: $(SRC)/common/list/%.c
 190         $(LINT.c) -c $<
 191 
 192 %.ln: $(SRC)/common/net/util/%.c
 193         $(LINT.c) -c $<
 194 
 195 %.ln: $(SRC)/common/util/%.c
 196         $(LINT.c) -c $<