home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 379a.lha / p2c1_13a / src / src.zoo / Makefile.orig < prev    next >
Makefile  |  1990-03-18  |  6KB  |  212 lines

  1. # Makefile for "p2c", the Pascal to C translator.
  2. #  Copyright (C) 1989 David Gillespie.
  3. #  Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125.
  4.  
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation (any 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; see the file COPYING.  If not, write to
  16. # the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. # Directories (private version)
  19. HOMEDIR = ../home
  20. INCDIR = ../home/p2c
  21. BINDIR = ..
  22. LIBDIR = ../home
  23. MANDIR = ../home
  24. MANFILE = p2c.cat          # human-readable manual (for cat.1)
  25. #MANFILE = p2c.man.inst    # uncompressed nroff source (for man.1)
  26. #MANFILE = p2c.man.Z       # compressed nroff source (for man.1.Z)
  27.  
  28. # Directories (public version)
  29. #HOMEDIR = /usr/lib/p2c
  30. #INCDIR = /usr/include/p2c
  31. #BINDIR = /usr/bin
  32. #LIBDIR = /usr/lib
  33. #MANDIR = /usr/man/man1
  34. #MANFILE = p2c.man.inst
  35.  
  36. # Compiler options
  37. CC = cc    # you may wish to use gcc here instead
  38. OPT = -O   # uncomment this for optimization
  39. DEB = # -g # uncomment this for debugging
  40. DEFS =       # place other -D types of things here
  41. CFLAGS = $(OPT) $(DEB) $(DEFS)
  42. LFLAGS =
  43.  
  44. # Custom translator modules
  45. CUSTSRCS = hpmods.c citmods.c
  46. CUSTOBJS = hpmods.o citmods.o
  47. CUSTDEFS = -DCUST1=hpmods -DCUST2=citmods
  48.  
  49. # File names
  50. SRC1 = trans.c stuff.c out.c comment.c dir.c
  51. SRC2 = parse1.c parse2.c parse3.c parse4.c
  52. SRC3 = decl1.c decl2.c decl3.c decl4.c decl5.c
  53. SRC4 = expr1.c expr2.c expr3.c expr4.c expr5.c
  54. SRC5 = pexpr1.c pexpr2.c pexpr3.c pexpr4.c
  55. SRC6 = lex1.c lex2.c lex3.c
  56. SRC7 = funcs1.c funcs2.c funcs3.c funcs4.c funcs5.c
  57. P2CSRCS = $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7)
  58. OBJ1 = trans.o stuff.o out.o comment.o dir.o
  59. OBJ2 = parse1.o parse2.o parse3.o parse4.o
  60. OBJ3 = decl1.o decl2.o decl3.o decl4.o decl5.o
  61. OBJ4 = expr1.o expr2.o expr3.o expr4.o expr5.o
  62. OBJ5 = pexpr1.o pexpr2.o pexpr3.o pexpr4.o
  63. OBJ6 = lex1.o lex2.o lex3.o
  64. OBJ7 = funcs1.o funcs2.o funcs3.o funcs4.o funcs5.o
  65. P2COBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7)
  66.  
  67. SRCS = $(P2CSRCS) $(CUSTSRCS)
  68. OBJS = $(P2COBJS) $(CUSTOBJS)
  69.  
  70. LIBSRCS = p2clib.c loc.p2clib.c
  71. LIBOBJS = p2clib.o loc.p2clib.o
  72. OTHERLIBOBJS =
  73.  
  74. ABSHOMEDIR = `cd $(HOMEDIR); pwd`
  75. ABSINCDIR = `cd $(INCDIR); pwd`
  76. ABSLIBDIR = `cd $(LIBDIR); pwd`
  77.  
  78. MISCSRCS = makeproto.c
  79. PROTOS = p2c.proto p2c.hdrs
  80. HDRS = trans.h p2c.h
  81.  
  82. # Top-level targets
  83. all: proto p2c libp2c.a p2c.cat
  84. proto: $(PROTOS)
  85.  
  86. lint: proto
  87.     lint $(SRCS)
  88.     lint $(LIBSRCS)
  89.     lint $(MISCSRCS)
  90.  
  91. # Making p2c
  92. p2c: $(OBJS)
  93.     $(CC) $(LFLAGS) $(OBJS) -o p2c
  94.  
  95. dir.o: dir.c trans.h
  96.     $(CC) -c $(CFLAGS) $(CUSTDEFS) dir.c
  97.  
  98. trans.o: trans.c trans.h
  99.     $(CC) -c $(CFLAGS) -DHASDUMPS -DP2C_HOME=\"$(ABSHOMEDIR)\" trans.c
  100.  
  101. # Making and using makeproto
  102. p2c.hdrs: $(SRCS) makeproto
  103.     ./makeproto -n -m -h -t16 -a35 -s0 -x $(SRCS) -o p2c.hdrs
  104.  
  105. p2c.proto: $(SRCS) makeproto
  106.     ./makeproto -n -m -h -t16 -a35 -s1 -i $(SRCS) -o p2c.proto
  107.  
  108. makeproto: makeproto.c
  109.     $(CC) $(CFLAGS) $(LFLAGS) makeproto.c -o makeproto
  110.  
  111. # Making the p2c runtime library
  112. libp2c.a: $(LIBOBJS)
  113.     ar r libp2c.a $(LIBOBJS) $(OTHERLIBOBJS)
  114.  
  115. p2clib.o: p2clib.c
  116.     $(CC) -c $(CFLAGS) p2clib.c
  117.  
  118. # Making the p2c man page
  119. p2c.man.inst: p2c.man
  120.     sed -e "s;--HOMEDIR--;$(ABSHOMEDIR);"   \
  121.             -e "s;--INCDIR--;$(ABSINCDIR);"     \
  122.             -e "s;--LIBDIR--;$(ABSLIBDIR);"     \
  123.             p2c.man >p2c.man.inst
  124.  
  125. p2c.man.Z: p2c.man.inst
  126.     compress -c p2c.man.inst >p2c.man.Z
  127.  
  128. p2c.cat: p2c.man.inst
  129.     if [ -f /usr/bin/nroff -o -f /bin/nroff ];  \
  130.         then nroff -man p2c.man.inst >p2c.cat; fi
  131.  
  132. # Initially installing p2c:
  133. #  First, make sure $(HOMEDIR) and $(INCDIR) exist and are writable;
  134. #  Second, make sure $(LIBDIR), $(BINDIR) and $(MANDIR) are writable;
  135. #  Third, execute "make install" to compile and set things up.
  136. # (You may need to have a system operator do these steps for you.)
  137.  
  138. COPY = cp
  139.  
  140. newhome:
  141.     -rm -f trans.o     # force trans.c to be recompiled (if HOMEDIR changes)
  142.  
  143. install: proto \
  144.     $(HOMEDIR) \
  145.     $(INCDIR) \
  146.     $(BINDIR)/p2c         \
  147.     $(LIBDIR)/libp2c.a    \
  148.     $(MANDIR)/p2c.1          \
  149.     $(INCDIR)/p2c.h          \
  150.     $(HOMEDIR)/p2crc      \
  151.     $(HOMEDIR)/loc.p2crc  \
  152.     $(HOMEDIR)/system.imp \
  153.     $(HOMEDIR)/system.m2  \
  154.     $(HOMEDIR)/turbo.imp  \
  155.     $(HOMEDIR)/string.pas
  156.  
  157. $(HOMEDIR):
  158.     mkdir $(HOMEDIR)
  159.  
  160. $(INCDIR):
  161.     mkdir $(INCDIR)
  162.  
  163. $(BINDIR)/p2c: p2c
  164.     $(COPY)  p2c          $(BINDIR)/p2c
  165.  
  166. SHELL=/bin/sh
  167. $(LIBDIR)/libp2c.a: libp2c.a
  168.     $(COPY)  libp2c.a     $(LIBDIR)/libp2c.a
  169.     if [ -f /usr/bin/ranlib -o -f /bin/ranlib ]; then ranlib $(LIBDIR)/libp2c.a; fi
  170.  
  171. $(MANDIR)/p2c.1: $(MANFILE)
  172.     $(COPY)  $(MANFILE)   $(MANDIR)/p2c.1
  173.  
  174. $(INCDIR)/p2c.h: p2c.h
  175.     $(COPY)  p2c.h        $(INCDIR)/p2c.h
  176.  
  177. $(HOMEDIR)/p2crc: sys.p2crc
  178.     $(COPY)  sys.p2crc    $(HOMEDIR)/p2crc
  179.  
  180. $(HOMEDIR)/loc.p2crc: loc.p2crc
  181.     $(COPY)  loc.p2crc    $(HOMEDIR)/loc.p2crc
  182.  
  183. $(HOMEDIR)/system.imp: system.imp
  184.     $(COPY)  system.imp   $(HOMEDIR)/system.imp
  185.  
  186. $(HOMEDIR)/system.m2: system.m2
  187.     $(COPY)  system.m2    $(HOMEDIR)/system.m2
  188.  
  189. $(HOMEDIR)/turbo.imp: turbo.imp
  190.     $(COPY)  turbo.imp    $(HOMEDIR)/turbo.imp
  191.  
  192. $(HOMEDIR)/string.pas: string.pas
  193.     $(COPY)  string.pas   $(HOMEDIR)/string.pas
  194.  
  195. # Miscellaneous
  196. tags:
  197.     etags $(SRCS) $(LIBSRCS) $(MISCSRCS) $(HDRS)
  198.  
  199. clean.o:
  200.     -rm -f $(OBJS)
  201.  
  202. clean:
  203.     -rm -f $(OBJS) $(LIBOBJS) $(PROTOS)
  204.     -rm -f p2c makeproto libp2c.a p2c.man.inst p2c.cat
  205.  
  206. wc:
  207.     wc $(SRCS) $(LIBSRCS) trans.h
  208.  
  209. test:
  210.     echo '"make test" should be used in the outer-level p2c directory.'
  211.     echo 'Type "cd .." and "make test" again.'
  212.