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 >
Wrap
Makefile
|
1990-03-18
|
6KB
|
212 lines
# Makefile for "p2c", the Pascal to C translator.
# Copyright (C) 1989 David Gillespie.
# Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation (any version).
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Directories (private version)
HOMEDIR = ../home
INCDIR = ../home/p2c
BINDIR = ..
LIBDIR = ../home
MANDIR = ../home
MANFILE = p2c.cat # human-readable manual (for cat.1)
#MANFILE = p2c.man.inst # uncompressed nroff source (for man.1)
#MANFILE = p2c.man.Z # compressed nroff source (for man.1.Z)
# Directories (public version)
#HOMEDIR = /usr/lib/p2c
#INCDIR = /usr/include/p2c
#BINDIR = /usr/bin
#LIBDIR = /usr/lib
#MANDIR = /usr/man/man1
#MANFILE = p2c.man.inst
# Compiler options
CC = cc # you may wish to use gcc here instead
OPT = -O # uncomment this for optimization
DEB = # -g # uncomment this for debugging
DEFS = # place other -D types of things here
CFLAGS = $(OPT) $(DEB) $(DEFS)
LFLAGS =
# Custom translator modules
CUSTSRCS = hpmods.c citmods.c
CUSTOBJS = hpmods.o citmods.o
CUSTDEFS = -DCUST1=hpmods -DCUST2=citmods
# File names
SRC1 = trans.c stuff.c out.c comment.c dir.c
SRC2 = parse1.c parse2.c parse3.c parse4.c
SRC3 = decl1.c decl2.c decl3.c decl4.c decl5.c
SRC4 = expr1.c expr2.c expr3.c expr4.c expr5.c
SRC5 = pexpr1.c pexpr2.c pexpr3.c pexpr4.c
SRC6 = lex1.c lex2.c lex3.c
SRC7 = funcs1.c funcs2.c funcs3.c funcs4.c funcs5.c
P2CSRCS = $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7)
OBJ1 = trans.o stuff.o out.o comment.o dir.o
OBJ2 = parse1.o parse2.o parse3.o parse4.o
OBJ3 = decl1.o decl2.o decl3.o decl4.o decl5.o
OBJ4 = expr1.o expr2.o expr3.o expr4.o expr5.o
OBJ5 = pexpr1.o pexpr2.o pexpr3.o pexpr4.o
OBJ6 = lex1.o lex2.o lex3.o
OBJ7 = funcs1.o funcs2.o funcs3.o funcs4.o funcs5.o
P2COBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7)
SRCS = $(P2CSRCS) $(CUSTSRCS)
OBJS = $(P2COBJS) $(CUSTOBJS)
LIBSRCS = p2clib.c loc.p2clib.c
LIBOBJS = p2clib.o loc.p2clib.o
OTHERLIBOBJS =
ABSHOMEDIR = `cd $(HOMEDIR); pwd`
ABSINCDIR = `cd $(INCDIR); pwd`
ABSLIBDIR = `cd $(LIBDIR); pwd`
MISCSRCS = makeproto.c
PROTOS = p2c.proto p2c.hdrs
HDRS = trans.h p2c.h
# Top-level targets
all: proto p2c libp2c.a p2c.cat
proto: $(PROTOS)
lint: proto
lint $(SRCS)
lint $(LIBSRCS)
lint $(MISCSRCS)
# Making p2c
p2c: $(OBJS)
$(CC) $(LFLAGS) $(OBJS) -o p2c
dir.o: dir.c trans.h
$(CC) -c $(CFLAGS) $(CUSTDEFS) dir.c
trans.o: trans.c trans.h
$(CC) -c $(CFLAGS) -DHASDUMPS -DP2C_HOME=\"$(ABSHOMEDIR)\" trans.c
# Making and using makeproto
p2c.hdrs: $(SRCS) makeproto
./makeproto -n -m -h -t16 -a35 -s0 -x $(SRCS) -o p2c.hdrs
p2c.proto: $(SRCS) makeproto
./makeproto -n -m -h -t16 -a35 -s1 -i $(SRCS) -o p2c.proto
makeproto: makeproto.c
$(CC) $(CFLAGS) $(LFLAGS) makeproto.c -o makeproto
# Making the p2c runtime library
libp2c.a: $(LIBOBJS)
ar r libp2c.a $(LIBOBJS) $(OTHERLIBOBJS)
p2clib.o: p2clib.c
$(CC) -c $(CFLAGS) p2clib.c
# Making the p2c man page
p2c.man.inst: p2c.man
sed -e "s;--HOMEDIR--;$(ABSHOMEDIR);" \
-e "s;--INCDIR--;$(ABSINCDIR);" \
-e "s;--LIBDIR--;$(ABSLIBDIR);" \
p2c.man >p2c.man.inst
p2c.man.Z: p2c.man.inst
compress -c p2c.man.inst >p2c.man.Z
p2c.cat: p2c.man.inst
if [ -f /usr/bin/nroff -o -f /bin/nroff ]; \
then nroff -man p2c.man.inst >p2c.cat; fi
# Initially installing p2c:
# First, make sure $(HOMEDIR) and $(INCDIR) exist and are writable;
# Second, make sure $(LIBDIR), $(BINDIR) and $(MANDIR) are writable;
# Third, execute "make install" to compile and set things up.
# (You may need to have a system operator do these steps for you.)
COPY = cp
newhome:
-rm -f trans.o # force trans.c to be recompiled (if HOMEDIR changes)
install: proto \
$(HOMEDIR) \
$(INCDIR) \
$(BINDIR)/p2c \
$(LIBDIR)/libp2c.a \
$(MANDIR)/p2c.1 \
$(INCDIR)/p2c.h \
$(HOMEDIR)/p2crc \
$(HOMEDIR)/loc.p2crc \
$(HOMEDIR)/system.imp \
$(HOMEDIR)/system.m2 \
$(HOMEDIR)/turbo.imp \
$(HOMEDIR)/string.pas
$(HOMEDIR):
mkdir $(HOMEDIR)
$(INCDIR):
mkdir $(INCDIR)
$(BINDIR)/p2c: p2c
$(COPY) p2c $(BINDIR)/p2c
SHELL=/bin/sh
$(LIBDIR)/libp2c.a: libp2c.a
$(COPY) libp2c.a $(LIBDIR)/libp2c.a
if [ -f /usr/bin/ranlib -o -f /bin/ranlib ]; then ranlib $(LIBDIR)/libp2c.a; fi
$(MANDIR)/p2c.1: $(MANFILE)
$(COPY) $(MANFILE) $(MANDIR)/p2c.1
$(INCDIR)/p2c.h: p2c.h
$(COPY) p2c.h $(INCDIR)/p2c.h
$(HOMEDIR)/p2crc: sys.p2crc
$(COPY) sys.p2crc $(HOMEDIR)/p2crc
$(HOMEDIR)/loc.p2crc: loc.p2crc
$(COPY) loc.p2crc $(HOMEDIR)/loc.p2crc
$(HOMEDIR)/system.imp: system.imp
$(COPY) system.imp $(HOMEDIR)/system.imp
$(HOMEDIR)/system.m2: system.m2
$(COPY) system.m2 $(HOMEDIR)/system.m2
$(HOMEDIR)/turbo.imp: turbo.imp
$(COPY) turbo.imp $(HOMEDIR)/turbo.imp
$(HOMEDIR)/string.pas: string.pas
$(COPY) string.pas $(HOMEDIR)/string.pas
# Miscellaneous
tags:
etags $(SRCS) $(LIBSRCS) $(MISCSRCS) $(HDRS)
clean.o:
-rm -f $(OBJS)
clean:
-rm -f $(OBJS) $(LIBOBJS) $(PROTOS)
-rm -f p2c makeproto libp2c.a p2c.man.inst p2c.cat
wc:
wc $(SRCS) $(LIBSRCS) trans.h
test:
echo '"make test" should be used in the outer-level p2c directory.'
echo 'Type "cd .." and "make test" again.'