1 #
   2 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
   3 # Use is subject to license terms.
   4 #
   5 
   6 NATIVE=native
   7 PROG= zic
   8 KSHPROG= tzselect
   9 NPROG= $(NATIVE)/$(PROG)
  10 
  11 # "etcetera" must be listed before "backward" because it sets up links that
  12 # "backward" needs.
  13 TZFILES= africa antarctica asia australasia etcetera europe \
  14          factory northamerica pacificnew solar87 solar88 solar89 \
  15          southamerica backward
  16 # Don't build the systemv timezones, but do install the source file.
  17 SRCFILES = $(TZFILES) systemv README
  18 TABFILES = continent.tab country.tab zone_sun.tab
  19 
  20 OBJS= zic.o scheck.o ialloc.o
  21 SRCS= $(OBJS:%.o=%.c)
  22 NOBJS= $(OBJS:%=$(NATIVE)/%)
  23 
  24 CLOBBERFILES= $(NOBJS) $(KSHPROG) $(NPROG) $(NATIVE)/zic.c $(NATIVE)/tzfile.h
  25 
  26 include ../Makefile.cmd
  27 
  28 NCPPFLAGS=      -I$(NATIVE)
  29 ROOTTZD=        $(ROOTSHLIB)/zoneinfo
  30 ROOTTZSRCD=     $(ROOTSHLIB)/zoneinfo/src
  31 ROOTTZTABD=     $(ROOTSHLIB)/zoneinfo/tab
  32 DIRS=  $(ROOTTZSRCD) $(ROOTTZTABD)
  33 
  34 CERRWARN +=     -_gcc=-Wno-unused-variable
  35 CERRWARN +=     -_gcc=-Wno-uninitialized
  36 
  37 ROOTLIBTZSRCFILES=      $(SRCFILES:%=$(ROOTTZSRCD)/%)
  38 ROOTLIBTZTABFILES=      $(TABFILES:%=$(ROOTTZTABD)/%)
  39 ROOTKSHPROG=    $(ROOTBIN)/$(KSHPROG)
  40 
  41 $(ROOTLIBTZSRCFILES):=  FILEMODE=       0644
  42 $(ROOTLIBTZTABFILES):=  FILEMODE=       0644
  43 
  44 #
  45 # Message catalog
  46 #
  47 POFILE2=tzselect.po
  48 POFILE3=zoneinfo.po
  49 POFILES3=$(TABFILES)
  50 TEXT_DOMAIN2=SUNW_OST_ZONEINFO
  51 MSGDOMAIN2=$(MSGROOT)/$(TEXT_DOMAIN2)
  52 
  53 # NB: $(POFILE2) is under SCM.
  54 CLOBBERFILES += $(POFILE) $(POFILE3)
  55 
  56 .KEEP_STATE:
  57 
  58 all: $(PROG) $(NPROG) $(KSHPROG)
  59 
  60 $(PROG): $(OBJS)
  61         $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
  62         $(POST_PROCESS)
  63 
  64 install: all $(DIRS) $(ROOTTZSRCD) $(ROOTTZTABD) $(ROOTUSRSBINPROG) \
  65                 $(ROOTLIBTZSRCFILES) $(ROOTLIBTZTABFILES) $(ROOTKSHPROG)
  66         $(NPROG) -d $(ROOTTZD) $(TZFILES)
  67 
  68 $(NPROG): $(NATIVE) $(NOBJS)
  69         $(NATIVECC) -o $@ $(NOBJS)
  70 
  71 #
  72 # XXX
  73 # There is a .ksh rule in Makefile.targ, but we need our custom POFILE rules.
  74 #
  75 $(KSHPROG):     $(KSHPROG).ksh
  76         $(RM) $@
  77         $(CAT) $(KSHPROG).ksh > $@
  78         $(CHMOD) +x $@
  79 
  80 $(ROOTTZSRCD)/%: %
  81         $(INS.file)
  82 
  83 $(ROOTTZTABD)/%: %
  84         $(INS.file)
  85 
  86 $(DIRS):
  87         $(INS.dir)
  88 
  89 $(NATIVE):
  90         -@mkdir -p $@
  91 
  92 clean:
  93         $(RM) $(OBJS)
  94 
  95 lint: lint_SRCS
  96 
  97 $(NOBJS): $$(@F:.o=.c)
  98         $(NATIVECC) -O $(NCPPFLAGS) -c -o $@ $(@F:.o=.c)
  99 
 100 $(NATIVE)/zic.o: $(NATIVE)/tzfile.h
 101 
 102 #$(NATIVE)/scheck.o: scheck.c
 103 #       $(NATIVECC) -c -o $@ scheck.c
 104 
 105 #$(NATIVE)/ialloc.o: ialloc.c
 106 #       $(NATIVECC) -c -o $@ ialloc.c
 107 
 108 $(NATIVE)/tzfile.h: $(ROOT)/usr/include/tzfile.h
 109         $(RM) $@; cp $(ROOT)/usr/include/tzfile.h $@
 110 
 111 #
 112 # From ../Makefile.targ
 113 #
 114 clobber: clean
 115         -$(RM) $(PROG) $(CLOBBERFILES)
 116 
 117 lint_PROG:
 118         $(LINT.c) $(PROG).c $(LDLIBS)
 119 
 120 lint_SRCS:
 121         $(LINT.c) $(SRCS) $(LDLIBS)
 122 
 123 #
 124 # For message catalogue files
 125 #
 126 _msg: $(MSGDOMAIN) $(POFILE) $(POFILE2) $(MSGDOMAIN2) $(POFILE3)
 127         $(RM) $(MSGDOMAIN)/$(POFILE)
 128         $(CP) $(POFILE) $(MSGDOMAIN)
 129         $(RM) $(MSGDOMAIN)/$(POFILE2)
 130         $(CP) $(POFILE2) $(MSGDOMAIN)
 131         $(RM) $(MSGDOMAIN2)/$(POFILE3)
 132         $(CP) $(POFILE3) $(MSGDOMAIN2)/$(POFILE3)
 133 
 134 $(MSGDOMAIN) $(DCMSGDOMAIN) $(MSGDOMAIN2):
 135         $(INS.dir)
 136 
 137 $(POFILE3):     $(POFILES3)
 138         $(RM) $@
 139         @/bin/sh ./do_pofile.sh > $@
 140