Makefile
上传用户:upcnvip
上传日期:2007-01-06
资源大小:474k
文件大小:5k
源码类别:

编译器/解释器

开发平台:

C/C++

  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. # 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 (any version).
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program; see the file COPYING.  If not, write to
  13. # the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. # Directories (private version)
  15. HOMEDIR = ../home
  16. INCDIR = ../home/p2c
  17. BINDIR = ..
  18. LIBDIR = ../home
  19. MANDIR = ../home
  20. MANFILE = p2c.cat          # human-readable manual (for cat.1)
  21. #MANFILE = p2c.man.inst    # uncompressed nroff source (for man.1)
  22. #MANFILE = p2c.man.Z       # compressed nroff source (for man.1.Z)
  23. # Directories (public version)
  24. #HOMEDIR = /usr/lib/p2c
  25. #INCDIR = /usr/include/p2c
  26. #BINDIR = /usr/bin
  27. #LIBDIR = /usr/lib
  28. #MANDIR = /usr/man/man1
  29. #MANFILE = p2c.man.inst
  30. # Compiler options
  31. CC = cc                    # you may wish to use gcc here instead
  32. OPT = # -O    # uncomment this for optimization
  33. DEB = # -g    # uncomment this for debugging
  34. DEFS =    # place other -D types of things here
  35. CFLAGS = $(OPT) $(DEB) $(DEFS)
  36. LFLAGS =
  37. # Custom translator modules
  38. CUSTSRCS = hpmods.c citmods.c
  39. CUSTOBJS = hpmods.o citmods.o
  40. CUSTDEFS = -DCUST1=hpmods -DCUST2=citmods
  41. # File names
  42. P2CSRCS = trans.c stuff.c out.c comment.c lex.c parse.c decl.c 
  43.           expr.c pexpr.c funcs.c dir.c
  44. P2COBJS = trans.o stuff.o out.o comment.o lex.o parse.o decl.o 
  45.           expr.o pexpr.o funcs.o dir.o
  46. SRCS = $(P2CSRCS) $(CUSTSRCS)
  47. OBJS = $(P2COBJS) $(CUSTOBJS)
  48. LIBSRCS = p2clib.c loc.p2clib.c
  49. LIBOBJS = p2clib.o loc.p2clib.o
  50. OTHERLIBOBJS =
  51. ABSHOMEDIR = `cd $(HOMEDIR); pwd`
  52. ABSINCDIR = `cd $(INCDIR); pwd`
  53. ABSLIBDIR = `cd $(LIBDIR); pwd`
  54. MISCSRCS = makeproto.c
  55. PROTOS = p2c.proto p2c.hdrs
  56. HDRS = trans.h p2c.h
  57. # Top-level targets
  58. all: proto p2c libp2c.a p2c.cat
  59. proto: $(PROTOS)
  60. # Making p2c
  61. p2c: $(OBJS)
  62. $(CC) $(LFLAGS) $(OBJS) -o p2c
  63. dir.o: dir.c trans.h
  64. $(CC) -c $(CFLAGS) $(CUSTDEFS) dir.c
  65. trans.o: trans.c trans.h
  66. $(CC) -c $(CFLAGS) -DHASDUMPS -DP2C_HOME="$(ABSHOMEDIR)" trans.c
  67. # Making and using makeproto
  68. p2c.hdrs: $(SRCS) makeproto
  69. ./makeproto -n -m -h -t16 -a35 -s0 -x $(SRCS) -o p2c.hdrs
  70. p2c.proto: $(SRCS) makeproto
  71. ./makeproto -n -m -h -t16 -a35 -s1 -i $(SRCS) -o p2c.proto
  72. makeproto: makeproto.c
  73. $(CC) $(CFLAGS) $(LFLAGS) makeproto.c -o makeproto
  74. # Making the p2c runtime library
  75. libp2c.a: $(LIBOBJS)
  76. ar r libp2c.a $(LIBOBJS) $(OTHERLIBOBJS)
  77. p2clib.o: p2clib.c
  78. $(CC) -c $(CFLAGS) p2clib.c
  79. # Making the p2c man page
  80. p2c.man.inst: p2c.man
  81. sed -e "s;--HOMEDIR--;$(ABSHOMEDIR);"   
  82.             -e "s;--INCDIR--;$(ABSINCDIR);"     
  83.             -e "s;--LIBDIR--;$(ABSLIBDIR);"     
  84.             p2c.man >p2c.man.inst
  85. p2c.man.Z: p2c.man.inst
  86. compress -c p2c.man.inst >p2c.man.Z
  87. p2c.cat: p2c.man.inst
  88. if [ -f /usr/bin/nroff -o -f /bin/nroff ];  
  89.     then nroff -man p2c.man.inst >p2c.cat; fi
  90. # Initially installing p2c:
  91. #  First, make sure $(HOMEDIR) and $(INCDIR) exist and are writable;
  92. #  Second, make sure $(LIBDIR), $(BINDIR) and $(MANDIR) are writable;
  93. #  Third, execute "make install" to compile and set things up.
  94. # (You may need to have a system operator do these steps for you.)
  95. COPY = cp
  96. newhome:
  97. rm -f trans.o     # force trans.c to be recompiled (if HOMEDIR changes)
  98. install: proto 
  99. $(BINDIR)/p2c         
  100. $(LIBDIR)/libp2c.a    
  101. $(MANDIR)/p2c.1       
  102. $(INCDIR)/p2c.h       
  103. $(HOMEDIR)/p2crc      
  104. $(HOMEDIR)/loc.p2crc  
  105. $(HOMEDIR)/system.imp 
  106. $(HOMEDIR)/system.m2  
  107. $(HOMEDIR)/turbo.imp  
  108. $(HOMEDIR)/string.pas
  109. $(BINDIR)/p2c: p2c
  110. $(COPY)  p2c          $(BINDIR)/p2c
  111. SHELL=/bin/sh
  112. $(LIBDIR)/libp2c.a: libp2c.a
  113. $(COPY)  libp2c.a     $(LIBDIR)/libp2c.a
  114. if [ -f /usr/bin/ranlib -o -f /bin/ranlib ]; then ranlib $(LIBDIR)/libp2c.a; fi
  115. $(MANDIR)/p2c.1: $(MANFILE)
  116. $(COPY)  $(MANFILE)   $(MANDIR)/p2c.1
  117. $(INCDIR)/p2c.h: p2c.h
  118. $(COPY)  p2c.h        $(INCDIR)/p2c.h
  119. $(HOMEDIR)/p2crc: sys.p2crc
  120. $(COPY)  sys.p2crc    $(HOMEDIR)/p2crc
  121. $(HOMEDIR)/loc.p2crc: loc.p2crc
  122. $(COPY)  loc.p2crc    $(HOMEDIR)/loc.p2crc
  123. $(HOMEDIR)/system.imp: system.imp
  124. $(COPY)  system.imp   $(HOMEDIR)/system.imp
  125. $(HOMEDIR)/system.m2: system.m2
  126. $(COPY)  system.m2    $(HOMEDIR)/system.m2
  127. $(HOMEDIR)/turbo.imp: turbo.imp
  128. $(COPY)  turbo.imp    $(HOMEDIR)/turbo.imp
  129. $(HOMEDIR)/string.pas: string.pas
  130. $(COPY)  string.pas   $(HOMEDIR)/string.pas
  131. # Miscellaneous
  132. tags:
  133. etags $(SRCS) $(LIBSRCS) $(MISCSRCS) $(HDRS)
  134. clean.o:
  135. rm $(OBJS)
  136. clean:
  137. rm $(OBJS) $(LIBOBJS) $(PROTOS) p2c
  138. wc:
  139. wc $(SRCS) $(LIBSRCS) trans.h
  140. test:
  141. echo '"make test" should be used in the outer-level p2c directory.'
  142. echo 'Type "cd .." and "make test" again.'