home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / fontutils-0.6-base.tgz / fontutils-0.6-base.tar / fsf / fontutils / data / defs.make < prev    next >
Text File  |  1992-10-27  |  5KB  |  150 lines

  1. # Common definitions for Makefiles in this directory hierarchy.
  2. # Copyright (C) 1992 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program 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
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.  
  19. # A GNUmakefile in this hierarchy should first include this file, and
  20. # then include either `defsprog.make' or `defslib.make', as appropriate.
  21. # Dependencies are created by `make depend', which writes onto the file
  22. # `M.depend'.  A Makefile should include that, also, at its end.
  23.  
  24.  
  25. # These variables are used only when the top-level Makefile is not.
  26. CC = gcc
  27. CFLAGS = -g
  28. LDFLAGS = $(XLDFLAGS)
  29. LIBS = -lm
  30. RANLIB = @true
  31. srcdir = .
  32.  
  33. # Here is the rule to make `foo.o' from `foo.c'.  We want CFLAGS to be
  34. # user-settable, so we can't use the default implicit rule.
  35. CPPFLAGS = -I../$(srcdir)/include $(xincludedir)
  36. %.o: %.c
  37.     $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
  38.  
  39. # Here is the rule to make `foo.c' from `foo.y' using Bison.
  40. # (GNU make's default rule assumes $(YACC) outputs y.tab.c.)
  41. # We always use Bison, not Yacc.
  42. BISON = bison
  43. BISONFLAGS = -d -t
  44. %.c %.h: %.y
  45.     $(BISON) $(BISONFLAGS) $< -o $*.c
  46.  
  47. # Libraries to support bitmap font formats.  Defined just so the main
  48. # Makefiles can use $(bitmap_libs), in case we ever add more formats.
  49. bitmap_libs = gf pk
  50.  
  51. # If the caller wants our widgets, they also want the other X libraries.
  52. # On SunOS 4.1, dynamic linking with -lXaw fails: formWidgetClass and
  53. # the other X widgets in ../widgets are multiply defined.  I don't
  54. # understand why the entire library file is pulled in with dynamic linking.
  55. ifneq "$(findstring widgets, $(libraries))" ""
  56. dlsym = ../$(srcdir)/lib/dlsym.o
  57. X_sys_libraries = -lXaw -lXmu -lXext -lXt -lX11
  58. X_libraries = -static $(xlibdir) $(X_sys_libraries) $(dlsym) $(wlibs)
  59. endif
  60.  
  61. # Compose the entire list of libraries from the defined `libraries'.  We
  62. # always add `lib' at the beginning and the end, since everything uses that.
  63. ourlibs := $(foreach lib,lib $(libraries) lib,../$(srcdir)/$(lib)/$(lib).a)
  64.  
  65. # This is what we will link with.
  66. LOADLIBES = $(ourlibs) $(X_libraries) $(LIBS)
  67.  
  68. # Make the list of object files, headers, and sources.  The headers only
  69. # matter for tags.
  70. sources := $(addsuffix .c, $(c_and_h) $(c_only))
  71. headers := $(addsuffix .h, $(c_and_h) $(h_only))
  72. objects := $(addsuffix .o, $(basename $(y) $(sources)))
  73.  
  74.  
  75. # These set things correctly for our development environment.
  76. ifeq ($(HOSTNAME_FULL),hayley.fsf.org)
  77. override CC = gcc -posix
  78. override CFLAGS := $(CFLAGS) -Wall
  79. override wlibs = -lnsl_s -linet
  80. endif
  81. ifeq ($(HOSTNAME_FULL),fosse.fsf.org)
  82. override xincludedir = -I/usr/local/include
  83. override RANLIB = ranlib
  84. endif
  85.  
  86. # The real default target is in either defslib.make or defsprog.make.
  87. default: all
  88. .PHONY: default
  89.  
  90. # Make the dependency file.
  91. # We don't depend on `$(sources)' because most changes to the sources don't
  92. # change the dependencies.
  93. # We assume at most one Bison source per directory here.  We also assume
  94. # GCC 2 for generating the dependencies of the Bison-generated C file.
  95. # Put the Bison stuff first in the dependency file, since typically lots
  96. # of other files depend on the Bison .h files.
  97. M.depend depend:
  98.     rm -f M.depend
  99.     if test -n "$(y)"; \
  100.         then DEPENDENCIES_OUTPUT="M.depend $(y).o" \
  101.                gcc -x c-header -E $(CPPFLAGS) $(y).y > /dev/null; \
  102.         fi
  103.     $(CC) -MM $(CPPFLAGS) $(sources) >> M.depend
  104. .PHONY: depend
  105.  
  106. # When `make dist' is called from above, we expect $(dir) to be set to
  107. # the directory in which  we're currently making.
  108. distdir = ../$(top_distdir)/$(dir)
  109.  
  110. # We use `find' instead of just `ln *.c *.h' here because not all
  111. # directories have .c and .h files.
  112. dist::
  113.     mkdir $(distdir)
  114.     ln ChangeLog GNUmakefile M.depend README $(distdir)
  115.     if test -n "$(y)"; then $(MAKE) $(y).c; fi
  116.     find \( -name \*.c -o -name \*.h \) -exec ln '{}' $(distdir)/'{}' \;
  117. .PHONY: dist
  118.  
  119. # Prevent GNU make version 3 from overflowing system V's arg limit.
  120. .NOEXPORT:
  121.  
  122. mostlyclean::
  123. # Remove most files.
  124.     rm -f $(objects) *.output
  125. .PHONY: mostlyclean
  126.  
  127. clean:: mostlyclean
  128. # Remove all files that are made by `make all', etc.
  129.     rm -f *.dvi *.log *.ps core
  130. .PHONY: clean
  131.  
  132. distclean:: clean
  133. # Delete all files that users would normally create from compilation and
  134. # installation. 
  135. .PHONY: distclean
  136.  
  137. extraclean:: distclean
  138. # Delete anything likely to be found in the source directory
  139. # that shouldn't be in the distribution.
  140.     rm -f *.tfm *gf *pk *.bzr *~ *\#* patch* *.orig *.rej
  141.  
  142. realclean:: distclean
  143. # Remove all files that can be remade with `make'.
  144.     rm -f TAGS M.depend $(addsuffix .c, $(y)) $(addsuffix .h, $(y))
  145. .PHONY: realclean
  146.