home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / glibc-1.06 / time / Makefile < prev    next >
Encoding:
Makefile  |  1993-05-22  |  3.6 KB  |  116 lines

  1. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License as
  6. # published by the Free Software Foundation; either version 2 of the
  7. # License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. #
  20. #    Makefile for time routines
  21. #
  22. subdir    := time
  23.  
  24. headers    := time.h sys/time.h
  25. distribute := tzfile.h private.h scheck.c ialloc.c emkdir.c yearistype
  26. extra-objs = scheck.o ialloc.o emkdir.o zonenames $(tzfiles:%=zones-%)
  27.  
  28. routines    := offtime asctime clock ctime difftime gmtime    \
  29.            localtime mktime strftime time __tzset tzfile \
  30.            __gettod settod adjtime getitmr \
  31.            __getitmr __adjtime __settod \
  32.            __setitmr tzset gettod setitmr \
  33.            stime
  34. aux        := syms-time
  35.  
  36. others    := ap zdump zic
  37. tests    := test_time
  38.  
  39. tzfiles := africa antarctica asia australasia europe northamerica \
  40.        southamerica etcetera factory systemv
  41. # pacificnew doesn't compile; if it is to be used, it should be included in
  42. # northamerica.
  43. distribute := $(distribute) $(tzfiles) leapseconds pacificnew
  44.  
  45. install := zic zdump
  46.  
  47. include ../Makeconfig    # Get objpfx defined so we can use it below.
  48.  
  49. # zonenames uses this variable.
  50. define nl
  51.  
  52.  
  53. endef
  54. include $(objpfx)zonenames
  55.  
  56. install-others = $(addprefix $(datadir)zoneinfo/,$(zonenames)        \
  57.                  $(filter-out /%,$(localtime-file)        \
  58.                          $(posixrules-file)))    \
  59.          $(filter /%,$(localtime-file) $(posixrules-file))
  60.  
  61. include ../Rules
  62.  
  63. $(tzfiles:%=$(objpfx)zones-%): $(objpfx)zones-%: % Makefile
  64. # Kludge alert: we use an implicit rule (in what we are generating here)
  65. # because that is the only way to tell Make that the one command builds all
  66. # the files.
  67.     (echo 'define $*-zones'                        ;\
  68.      awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\
  69.      echo 'endef'                            ;\
  70.      echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))'        ;\
  71.      echo 'ifdef $*-zones'                        ;\
  72.      echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \'    ;\
  73.      echo '$< $$(objpfx)zic leapseconds'                ;\
  74.      echo '    $$(tzcompile)'                        ;\
  75.      echo 'endif'                            ;\
  76.      echo 'zonenames := $$(zonenames) $$($*-zones)'            ;\
  77.     ) > $@.new
  78.     mv $@.new $@
  79. $(objpfx)zonenames: Makefile
  80.     (for file in $(tzfiles); do \
  81.        echo "include \$$(objpfx)zones-$$file"; \
  82.      done) > $@.new
  83.     mv $@.new $@
  84.  
  85. .PHONY: echo-zonenames
  86. echo-zonenames: zonenames
  87.     @echo 'Known zones: $(zonenames)'
  88.  
  89.  
  90. zic-cmd = $(dir $(word 2,$^))$(notdir $(word 2,$^))
  91. define tzcompile
  92. $(zic-cmd) -d $(patsubst %/,%,$(word 4,$^)) -L $(word 3,$^) $<
  93. endef
  94.  
  95. ifdef localtime
  96. $(datadir)/zoneinfo/localtime: $(datadir)/zoneinfo/$(localtime) $(objpfx)zic
  97.     $(zic-cmd) -d $(@D) -l $(<F)
  98. endif
  99. ifdef posixrules
  100. $(datadir)/zoneinfo/posixrules: $(datadir)/zoneinfo/$(posixrules) $(objpfx)zic
  101.     $(zic-cmd) -d $(@D) -p $(<F)
  102. endif
  103.  
  104.  
  105. $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o $(objpfx)emkdir.o
  106.  
  107. $(objpfx)tzfile.o: tzfile.c; $(tz-cc)
  108. $(objpfx)zic.o: zic.c; $(tz-cc)
  109.  
  110. # Some versions of GNU make have a bug with backslashes in define directives.
  111. tz-cc = $(COMPILE.c) $(+gcc-nowarn) \
  112.          -DTZDIR='"$(datadir)/zoneinfo"' \
  113.          -DTZDEFAULT='"$(localtime-file)"' \
  114.          -DTZDEFRULES='"$(posixrules-file)"' \
  115.          $< $(OUTPUT_OPTION)
  116.