home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d0xx / d028 / cpp.lha / Cpp / Makefile < prev    next >
Encoding:
Makefile  |  1986-07-17  |  3.8 KB  |  144 lines

  1. # Makefile for cpp
  2. #
  3. # On certain systems, such as Unix System III, you may need to define
  4. # $(LINTFLAGS) in the make command line to set system-specific lint flags.
  5. #
  6. # This Makefile assumes cpp will replace the "standard" preprocessor.
  7. # Delete the reference to -DLINE_PREFIX=\"\" if cpp is used stand-alone.
  8. # LINEFIX is a sed script filter that reinserts #line -- used for testing
  9. # if LINE_PREFIX is set to "".   Note that we must stand on our heads to
  10. # match the # and a line had better not begin with $.  By the way, what
  11. # we really want is
  12. #    LINEFIX = | sed "s/^#/#line/"
  13. #
  14. CPPDEFINE = -DLINE_PREFIX=\"\"
  15. #LINEFIX = | sed "s/^[^ !\"%-~]/&line/"
  16. #
  17. # Define OLD_PREPROCESSOR non-zero to make a preprocessor which is
  18. # "as compatible as possible" with the standard Unix V7 or Ultrix
  19. # preprocessors.  This is needed to rebuild 4.2bsd, for example, as
  20. # the preprocessor is used to modify assembler code, rather than C.
  21. # This is not recommended for current development.  OLD_PREPROCESSOR
  22. # forces the following definitions:
  23. #   OK_DOLLAR        FALSE    $ is not allowed in variables
  24. #   OK_CONCAT        FALSE    # cannot concatenate tokens
  25. #   COMMENT_INVISIBLE    TRUE    old-style comment concatenation
  26. #   STRING_FORMAL    TRUE    old-style string expansion
  27. #
  28. OLDDEFINE = -DOLD_PREPROCESSOR=1
  29. HOST = -DHOST=SYS_UNIX
  30. #
  31. # DEFINES collects all -D arguments for cc and lint:
  32. # Change DEFINES = $(CPPDEFINE) $(OLDDEFINE)
  33. # for an old-style preprocessor.
  34. # If being used for GNU Emacs, the macro EMACS will be defined as -DEMACS.
  35. #
  36. DEFINES = $(CPPDEFINE) $(OLDDEFINE) $(EMACS) $(HOST)
  37.  
  38. CC =        cc
  39. #DEBUGFLAG =    -g
  40. CFLAGS =    $(DEBUGFLAG) $(DEFINES)
  41. LIBS =        -ldbug
  42.  
  43. #
  44. # ** compile cpp
  45. #
  46. SRCS =    cpp1.c cpp2.c cpp3.c cpp4.c cpp5.c cpp6.c
  47. OBJS =    cpp1.o cpp2.o cpp3.o cpp4.o cpp5.o cpp6.o
  48.  
  49. cpp :    $(OBJS)
  50.     $(CC) -o cpp $(LDFLAGS) $(OBJS) $(LIBS)
  51.  
  52. #
  53. # ** Test cpp by preprocessing itself, compiling the result,
  54. # ** repeating the process and diff'ing the result.  Note: this
  55. # ** is not a good test of cpp, but a simple verification.
  56. # ** The diff's should not report any changes.
  57. # ** Note that a sed script may be executed for each compile
  58. #
  59. test :
  60.     cpp cpp1.c $(LINEFIX) >old.tmp1.c
  61.     cpp cpp2.c $(LINEFIX) >old.tmp2.c
  62.     cpp cpp3.c $(LINEFIX) >old.tmp3.c
  63.     cpp cpp4.c $(LINEFIX) >old.tmp4.c
  64.     cpp cpp5.c $(LINEFIX) >old.tmp5.c
  65.     cpp cpp6.c $(LINEFIX) >old.tmp6.c
  66.     $(CC) $(CFLAGS) old.tmp[123456].c
  67.     a.out cpp1.c >new.tmp1.c
  68.     a.out cpp2.c >new.tmp2.c
  69.     a.out cpp3.c >new.tmp3.c
  70.     a.out cpp4.c >new.tmp4.c
  71.     a.out cpp5.c >new.tmp5.c
  72.     a.out cpp6.c >new.tmp6.c
  73.     diff old.tmp1.c new.tmp1.c
  74.     diff old.tmp2.c new.tmp2.c
  75.     diff old.tmp3.c new.tmp3.c
  76.     diff old.tmp4.c new.tmp4.c
  77.     diff old.tmp5.c new.tmp5.c
  78.     diff old.tmp6.c new.tmp6.c
  79.     rm a.out old.tmp[123456].* new.tmp[123456].*
  80.  
  81. #
  82. # A somewhat more extensive test is provided by the "clock"
  83. # program (which is not distributed).  Substitute your favorite
  84. # macro-rich program here.
  85. #
  86. clock :    clock.c cpp
  87.     cpp clock.c $(LINEFIX) >temp.cpp.c
  88.     cc temp.cpp.c -lcurses -ltermcap -o clock
  89.     rm temp.cpp.c
  90.  
  91. #
  92. # ** Lint the code
  93. #
  94.  
  95. lint :    $(SRCS)
  96.     lint $(LINTFLAGS) $(DEFINES) $(SRCS)
  97.  
  98. #
  99. # ** Remove unneeded files
  100. #
  101. clean :
  102.     rm -f $(OBJS) cpp
  103.  
  104. #
  105. # ** Rebuild the archive files needed to distribute cpp
  106. # ** Uses the Decus C archive utility.
  107. #
  108.  
  109. archc :    archc.c
  110.     $(CC) $(CFLAGS) archc.c -o archc
  111.  
  112. archx :    archx.c
  113.     $(CC) $(CFLAGS) archx.c -o archx
  114.  
  115. archive : archc
  116.     archc readme.txt cpp.mem archx.c archc.c cpp.rno makefile.txt \
  117.         cpp*.h >cpp1.arc
  118.     archc cpp1.c cpp2.c cpp3.c >cpp2.arc
  119.     archc cpp4.c cpp5.c cpp6.c >cpp3.arc
  120.  
  121. #
  122. # Object module dependencies
  123. #
  124.  
  125. cpp1.o    :    cpp1.c cpp.h cppdef.h
  126.         $(CC) -c $(CFLAGS) cpp1.c
  127.  
  128. cpp2.o    :    cpp2.c cpp.h cppdef.h
  129.         $(CC) -c $(CFLAGS) cpp2.c
  130.  
  131. cpp3.o    :    cpp3.c cpp.h cppdef.h
  132.         $(CC) -c $(CFLAGS) cpp3.c
  133.  
  134. cpp4.o    :    cpp4.c cpp.h cppdef.h
  135.         $(CC) -c $(CFLAGS) cpp4.c
  136.  
  137. cpp5.o    :    cpp5.c cpp.h cppdef.h
  138.         $(CC) -c $(CFLAGS) cpp5.c
  139.  
  140. cpp6.o    :    cpp6.c cpp.h cppdef.h
  141.         $(CC) -c $(CFLAGS) cpp6.c
  142.  
  143.  
  144.