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