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 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  22 # Use is subject to license terms.
  23 #
  24 
  25 $(NOT_NATIVE)NATIVE_BUILD = $(POUND_SIGN)
  26 
  27 ITM     = geniconvtbl.so
  28 PROG    = geniconvtbl
  29 
  30 SRCSH1  = iconv_tm.h hash.h
  31 SRCCH1  = itmcomp.h itm_util.h maptype.h
  32 SRCSC1  = itmcomp.c assemble.c disassemble.c itm_util.c
  33 SRCY1   = itm_comp.y
  34 SRCL1   = itm_comp.l
  35 SRCI1   = geniconvtbl.c
  36 
  37 
  38 YTABC   = y.tab.c
  39 YTABH   = y.tab.h
  40 LEXYY   = lex.yy.c
  41 YOUT    = y.output
  42 MAPFILE = ../mapfile
  43 
  44 
  45 
  46 SRCSH   = $(SRCSH1:%.h=../%.h)
  47 SRCCH   = $(SRCCH1:%.h=../%.h)
  48 SRCSC   = $(SRCSC1:%.c=../%.c)
  49 SRCI    = $(SRCI1:%.c=../%.c)
  50 SRCY    = $(SRCY1:%.y=../%.y)
  51 SRCL    = $(SRCL1:%.l=../%.l)
  52 
  53 SRCYC   = $(SRCY:%.y=%.c)
  54 SRCLC   = $(SRCL:%.l=%.c)
  55 
  56 SRCS    = $(SRCSC) $(YTABC) $(LEXYY)
  57 HDRS    = $(SRCCH1) $(ERNOSTRH)
  58 
  59 
  60 
  61 SED     = sed
  62 LEXSED  = ../lex.sed
  63 YACCSED = ../yacc.sed
  64 
  65 
  66 
  67 # include ../../../lib/Makefile.lib
  68 include ../../Makefile.cmd
  69 
  70 
  71 ROOTDIRS32=     $(ROOTLIB)/iconv
  72 ROOTDIRS64=     $(ROOTLIB)/iconv/$(MACH64)
  73 ROOTITM32 =     $(ROOTDIRS32)/$(ITM)
  74 ROOTITM64 =     $(ROOTDIRS64)/$(ITM)
  75 
  76 # defined for some useful targets like clean,
  77 OBJS    = $(SRCSC1:%.c=%.o) $(YTABC:.c=.o) $(LEXYY:.c=.o)
  78 
  79 CHECKHDRS = $(HDRS%.h=%.check)
  80 
  81 CLOBBERFILES=   $(ITM) $(SRCYC)
  82 CLEANFILES =    $(OBJS) $(YTABC) $(YTABH) $(LEXYY) $(YOUT) \
  83                 $(POFILES) $(POFILE)
  84 
  85 CPPFLAGS        += -I. -I..
  86 CERRWARN        += -_gcc=-Wno-uninitialized
  87 CERRWARN        += -_gcc=-Wno-unused-label
  88 CERRWARN        += -_gcc=-Wno-switch
  89 CERRWARN        += -_gcc=-Wno-unused-variable
  90 CERRWARN        += -_gcc=-Wno-implicit-function-declaration
  91 YFLAGS          += -d -v
  92 CFLAGS          += -D_FILE_OFFSET_BITS=64
  93 
  94 $(ITM) :=       CFLAGS += $(GSHARED) $(C_PICFLAGS) $(ZTEXT) -h $@
  95 $(ITM) :=       CPPFLAGS += -D_REENTRANT
  96 $(ITM) :=       sparc_CFLAGS += -xregs=no%appl
  97 $(ITM) :=       sparcv9_CFLAGS += -xregs=no%appl
  98 
  99 LDLIBS += -lgen
 100 
 101 MY_NATIVE_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -I. -I..
 102 MY_NATIVE_LDFLAGS = $(MAPFILE.NES:%=-M%) $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%)
 103 MY_NATIVE_LDLIBS = -lgen
 104 
 105 #
 106 # Message catalog
 107 #
 108 POFILES= $(SRCSC1:%.c=%.po) $(SRCI1:%.c=%.po) \
 109                 $(SRCY1:%.y=%.po) $(SRCL1:%.l=%.po)
 110 
 111 POFILE= geniconvtbl_.po
 112 
 113 
 114 
 115 
 116 
 117 .KEEP_STATE:
 118 
 119 .PARALLEL: $(ITM) $(OBJS)
 120 
 121 $(PROG): $(OBJS)
 122         $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
 123         $(POST_PROCESS)
 124 
 125 $(ITM): $(SRCI)
 126         $(CC) $(CFLAGS) $(CPPFLAGS) -M$(MAPFILE) -o $@ $(SRCI) $(LDLIBS)
 127         $(POST_PROCESS_SO)
 128 
 129 $(YTABC) $(YTABH): $(SRCY)
 130         $(YACC) $(YFLAGS) $(SRCY)
 131         @ $(MV) $(YTABC) $(YTABC)~
 132         @ $(SED) -f $(YACCSED) $(YTABC)~ > $(YTABC)
 133         @ $(RM) $(YTABC)~
 134 
 135 $(LEXYY): $(SRCL) $(YTABH)
 136         $(LEX) -t $(SRCL) | $(SED) -f $(LEXSED) > $(LEXYY)
 137 
 138 
 139 $(POFILE):  .WAIT $(POFILES)
 140         $(RM) $@
 141         $(CAT) $(POFILES) >$@
 142 
 143 $(POFILES): $(SRCSC) $(SRCI) $(SRCY) $(SRCL)
 144 
 145 %.po:   ../%.c
 146         $(COMPILE.cpp) $<  > $<.i
 147         $(BUILD.po)
 148 
 149 
 150 lint : lint_SRCS1  lint_SRCS2
 151 
 152 
 153 lint_SRCS1: $(SRCS)
 154         $(LINT.c) $(SRCS) $(LDLIBS)
 155 
 156 lint_SRCS2: $(SRCI)
 157         $(LINT.c) $(SRCI) $(LDLIBS)
 158 
 159 
 160 
 161 hdrchk: $(HDRCHECKS)
 162 
 163 cstyle: $(SRCS)
 164         $(DOT_C_CHECK)
 165 
 166 clean:
 167         $(RM) $(CLEANFILES)
 168 
 169 %.o:    %.c
 170         $(COMPILE.c) $<
 171 
 172 %.o:    ../%.c
 173         $(COMPILE.c) $<
 174 
 175 
 176 
 177 # install rule
 178 $(ROOTDIRS32)/%: $(ROOTDIRS32) %
 179         -$(INS.file)
 180 
 181 $(ROOTDIRS64)/%: $(ROOTDIRS64) %
 182         -$(INS.file)
 183 
 184 $(ROOTDIRS32): $(ROOTLIB)
 185         -$(INS.dir)
 186 
 187 $(ROOTDIRS64): $(ROOTDIRS32)
 188         -$(INS.dir)
 189 
 190 $(ROOTLIB) $(ROOTBIN):
 191         -$(INS.dir)
 192 
 193 include ../../Makefile.targ
 194