home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 342b.lha / cpp / makefile < prev    next >
Makefile  |  1990-01-26  |  4KB  |  139 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. # The following kludge bypasses the need for Fred's cc program by
  29. # invoking the cpp front end cpp preprocessor.    The intermediate file
  30. # is stored in ram, pre-appended with an underscore.  Manx's cc program
  31. # is then invoked on the intermediate file.  The amigados delete command
  32. # kills the intermediate file.
  33.  
  34. #OLDDEFINE = -DOLD_PREPROCESSOR=1
  35. HOST = -Damiga -Dpdc
  36. EMACS =
  37. DEBUGFLAG =
  38. LDFLAGS =
  39. #
  40. # DEFINES collects all -D arguments for cc and lint:
  41. # Change DEFINES = $(CPPDEFINE) $(OLDDEFINE)
  42. # for an old-style preprocessor.
  43. # If being used for GNU Emacs, the macro EMACS will be defined as -DEMACS.
  44. #
  45. DEFINES = $(OLDDEFINE) $(EMACS) $(HOST)
  46.  
  47. CC =        cc
  48. #DEBUGFLAG =    -g
  49. CFLAGS =    $(DEBUGFLAG) $(DEFINES) $(CPPDEFINE)
  50. LIBS =        -lc32
  51.  
  52. .c.o:
  53.     OldCpp $(CFLAGS) $*.c ram:_$*.c
  54.     cc +L -o $*.o ram:_$*.c
  55.     delete ram:_$*.c
  56.  
  57. # ** compile cpp
  58. #
  59. SRCS =    cpp1.c cpp2.c cpp3.c cpp4.c cpp5.c cpp6.c
  60. OBJS =    cpp1.o cpp2.o cpp3.o cpp4.o cpp5.o cpp6.o
  61.  
  62. cpp :    $(OBJS)
  63.     ln -o Cpp $(LDFLAGS) $(OBJS) $(LIBS)
  64.  
  65. #
  66. # ** Test cpp by preprocessing itself, compiling the result,
  67. # ** repeating the process and diff'ing the result.  Note: this
  68. # ** is not a good test of cpp, but a simple verification.
  69. # ** The diff's should not report any changes.
  70. # ** Note that a sed script may be executed for each compile
  71. #
  72. test :
  73.     cpp cpp1.c $(LINEFIX) >old.tmp1.c
  74.     cpp cpp2.c $(LINEFIX) >old.tmp2.c
  75.     cpp cpp3.c $(LINEFIX) >old.tmp3.c
  76.     cpp cpp4.c $(LINEFIX) >old.tmp4.c
  77.     cpp cpp5.c $(LINEFIX) >old.tmp5.c
  78.     cpp cpp6.c $(LINEFIX) >old.tmp6.c
  79.     $(CC) $(CFLAGS) old.tmp[123456].c
  80.     a.out cpp1.c >new.tmp1.c
  81.     a.out cpp2.c >new.tmp2.c
  82.     a.out cpp3.c >new.tmp3.c
  83.     a.out cpp4.c >new.tmp4.c
  84.     a.out cpp5.c >new.tmp5.c
  85.     a.out cpp6.c >new.tmp6.c
  86.     diff old.tmp1.c new.tmp1.c
  87.     diff old.tmp2.c new.tmp2.c
  88.     diff old.tmp3.c new.tmp3.c
  89.     diff old.tmp4.c new.tmp4.c
  90.     diff old.tmp5.c new.tmp5.c
  91.     diff old.tmp6.c new.tmp6.c
  92.     rm a.out old.tmp[123456].* new.tmp[123456].*
  93.  
  94. #
  95. # A somewhat more extensive test is provided by the "clock"
  96. # program (which is not distributed).  Substitute your favorite
  97. # macro-rich program here.
  98. #
  99. clock : clock.c cpp
  100.     cpp clock.c $(LINEFIX) >temp.cpp.c
  101.     cc temp.cpp.c -lcurses -ltermcap -o clock
  102.     rm temp.cpp.c
  103.  
  104. #
  105. # ** Lint the code
  106. #
  107.  
  108. lint :    $(SRCS)
  109.     lint $(LINTFLAGS) $(DEFINES) $(SRCS)
  110.  
  111. #
  112. # ** Remove unneeded files
  113. #
  114. clean :
  115.     rm -f $(OBJS) cpp
  116.  
  117. #
  118. # ** Rebuild the archive files needed to distribute cpp
  119. # ** Uses the Decus C archive utility.
  120. #
  121.  
  122. archc : archc.c
  123.     $(CC) $(CFLAGS) archc.c -o archc
  124.  
  125. archx : archx.c
  126.     $(CC) $(CFLAGS) archx.c -o archx
  127.  
  128. archive : archc
  129.     archc readme.txt cpp.mem archx.c archc.c cpp.rno makefile.txt \
  130.         cpp*.h >cpp1.arc
  131.     archc cpp1.c cpp2.c cpp3.c >cpp2.arc
  132.     archc cpp4.c cpp5.c cpp6.c >cpp3.arc
  133.  
  134. #
  135. # Object module dependencies
  136. #
  137.  
  138. $(OBJS) :       cpp.h cppdef.h
  139.