|
|
e9ad7a |
diff -ru p2c-2.02.orig/Makefile p2c-2.02/Makefile
|
|
|
e9ad7a |
--- p2c-2.02.orig/Makefile 1993-12-08 06:37:05.000000000 +0100
|
|
|
e9ad7a |
+++ p2c-2.02/Makefile 2024-03-20 10:32:36.899062261 +0100
|
|
|
e9ad7a |
@@ -24,25 +24,7 @@
|
|
|
e9ad7a |
# and src/Makefile.
|
|
|
e9ad7a |
|
|
|
e9ad7a |
test:
|
|
|
e9ad7a |
- @echo "Compiling p2c, installing in `pwd`/home..."
|
|
|
e9ad7a |
- cd src; make install
|
|
|
e9ad7a |
- @echo ""
|
|
|
e9ad7a |
- @echo "Translating and compiling example files..."
|
|
|
e9ad7a |
- cd examples; make comp
|
|
|
e9ad7a |
- @echo ""
|
|
|
e9ad7a |
- @echo "Running the factorial example..."
|
|
|
e9ad7a |
- examples/fact
|
|
|
e9ad7a |
- @echo ""
|
|
|
e9ad7a |
- @echo "Running the 'e' computation example..."
|
|
|
e9ad7a |
- examples/e
|
|
|
e9ad7a |
- @echo ""
|
|
|
e9ad7a |
- @echo "Running the self-printing Pascal example..."
|
|
|
e9ad7a |
- examples/self >examples/self.out
|
|
|
e9ad7a |
- cat examples/self.out
|
|
|
e9ad7a |
- diff examples/self.p examples/self.out
|
|
|
e9ad7a |
- @echo ""
|
|
|
e9ad7a |
- @echo "Also try 'cref' and 'basic' in the examples directory."
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
+ cd src; make
|
|
|
e9ad7a |
|
|
|
e9ad7a |
install:
|
|
|
e9ad7a |
cd src; make install
|
|
|
e9ad7a |
diff -ru p2c-2.02.orig/src/Makefile p2c-2.02/src/Makefile
|
|
|
e9ad7a |
--- p2c-2.02.orig/src/Makefile 2015-11-18 21:12:06.000000000 +0100
|
|
|
e9ad7a |
+++ p2c-2.02/src/Makefile 2024-03-20 10:32:36.899062261 +0100
|
|
|
e9ad7a |
@@ -19,25 +19,21 @@
|
|
|
e9ad7a |
SHELL = /bin/sh
|
|
|
e9ad7a |
|
|
|
e9ad7a |
# Directories (private version)
|
|
|
e9ad7a |
-HOMEDIR = ../home
|
|
|
e9ad7a |
-INCDIR = ../home/p2c
|
|
|
e9ad7a |
-BINDIR = ..
|
|
|
e9ad7a |
-LIBDIR = ../home
|
|
|
e9ad7a |
-MANDIR = ../home
|
|
|
e9ad7a |
-MANFILE = p2c.cat # human-readable manual (for cat.1)
|
|
|
e9ad7a |
#MANFILE = p2c.man.inst # uncompressed nroff source (for man.1)
|
|
|
e9ad7a |
#MANFILE = p2c.man.Z # compressed nroff source (for man.1.Z)
|
|
|
e9ad7a |
|
|
|
e9ad7a |
# Directories (public version)
|
|
|
e9ad7a |
-#HOMEDIR = /usr/lib/p2c
|
|
|
e9ad7a |
-#INCDIR = /usr/include/p2c
|
|
|
e9ad7a |
-#BINDIR = /usr/bin
|
|
|
e9ad7a |
-#LIBDIR = /usr/lib
|
|
|
e9ad7a |
-#MANDIR = /usr/man/man1
|
|
|
e9ad7a |
-#MANFILE = p2c.man.inst
|
|
|
e9ad7a |
+HOMEDIR = /usr/lib/p2c
|
|
|
e9ad7a |
+INCDIR = /usr/include/p2c
|
|
|
e9ad7a |
+BINDIR = /usr/bin
|
|
|
e9ad7a |
+LIBDIR = /usr/lib
|
|
|
e9ad7a |
+MANDIR = /usr/man/man1
|
|
|
e9ad7a |
+MANFILE = p2c.man.inst
|
|
|
e9ad7a |
+DESTDIR ?=
|
|
|
e9ad7a |
|
|
|
e9ad7a |
# Compiler options
|
|
|
e9ad7a |
CC = cc # you may wish to use gcc here instead
|
|
|
e9ad7a |
+AR = ar
|
|
|
e9ad7a |
OPT = # -O # uncomment this for optimization
|
|
|
e9ad7a |
DEB = # -g # uncomment this for debugging
|
|
|
e9ad7a |
DEFS = -DTEST_MALLOC # place other -D types of things here # TDS 2015nov18
|
|
|
e9ad7a |
@@ -74,7 +70,7 @@
|
|
|
e9ad7a |
|
|
|
e9ad7a |
|
|
|
e9ad7a |
# Top-level targets
|
|
|
e9ad7a |
-all: proto p2c libp2c.a p2c.cat
|
|
|
e9ad7a |
+all: proto p2c libp2c.a p2c.cat proto
|
|
|
e9ad7a |
proto: $(PROTOS)
|
|
|
e9ad7a |
|
|
|
e9ad7a |
|
|
|
e9ad7a |
@@ -86,7 +82,7 @@
|
|
|
e9ad7a |
$(CC) -c $(CFLAGS) $(CUSTDEFS) dir.c
|
|
|
e9ad7a |
|
|
|
e9ad7a |
trans.o: trans.c trans.h
|
|
|
e9ad7a |
- $(CC) -c $(CFLAGS) -DHASDUMPS -DP2C_HOME=\"$(ABSHOMEDIR)\" trans.c
|
|
|
e9ad7a |
+ $(CC) -c $(CFLAGS) -DHASDUMPS -DP2C_HOME=\"/usr/lib/p2c\" trans.c
|
|
|
e9ad7a |
|
|
|
e9ad7a |
|
|
|
e9ad7a |
# Making and using makeproto
|
|
|
e9ad7a |
@@ -97,12 +93,12 @@
|
|
|
e9ad7a |
./makeproto -n -m -h -t16 -a35 -s1 -i $(SRCS) -o p2c.proto
|
|
|
e9ad7a |
|
|
|
e9ad7a |
makeproto: makeproto.c
|
|
|
e9ad7a |
- $(CC) $(CFLAGS) $(LFLAGS) makeproto.c -o makeproto
|
|
|
e9ad7a |
+ $(HOST_CC) $(CFLAGS) $(LFLAGS) makeproto.c -o makeproto
|
|
|
e9ad7a |
|
|
|
e9ad7a |
|
|
|
e9ad7a |
# Making the p2c runtime library
|
|
|
e9ad7a |
libp2c.a: $(LIBOBJS)
|
|
|
e9ad7a |
- ar r libp2c.a $(LIBOBJS) $(OTHERLIBOBJS)
|
|
|
e9ad7a |
+ $(AR) r libp2c.a $(LIBOBJS) $(OTHERLIBOBJS)
|
|
|
e9ad7a |
|
|
|
e9ad7a |
p2clib.o: p2clib.c
|
|
|
e9ad7a |
$(CC) -c $(CFLAGS) p2clib.c
|
|
|
e9ad7a |
@@ -145,61 +141,23 @@
|
|
|
e9ad7a |
newhome:
|
|
|
e9ad7a |
rm -f trans.o # force trans.c to be recompiled (if HOMEDIR changes)
|
|
|
e9ad7a |
|
|
|
e9ad7a |
-install: proto \
|
|
|
e9ad7a |
- makedirs \
|
|
|
e9ad7a |
- $(BINDIR)/p2c \
|
|
|
e9ad7a |
- $(BINDIR)/p2cc \
|
|
|
e9ad7a |
- $(LIBDIR)/libp2c.a \
|
|
|
e9ad7a |
- $(MANDIR)/p2c.1 \
|
|
|
e9ad7a |
- $(INCDIR)/p2c.h \
|
|
|
e9ad7a |
- $(HOMEDIR)/p2crc \
|
|
|
e9ad7a |
- $(HOMEDIR)/loc.p2crc \
|
|
|
e9ad7a |
- $(HOMEDIR)/system.imp \
|
|
|
e9ad7a |
- $(HOMEDIR)/system.m2 \
|
|
|
e9ad7a |
- $(HOMEDIR)/turbo.imp \
|
|
|
e9ad7a |
- $(HOMEDIR)/string.pas
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-SHELL=/bin/sh
|
|
|
e9ad7a |
-makedirs:
|
|
|
e9ad7a |
- if [ ! -d $(HOMEDIR) ]; then mkdir $(HOMEDIR); else true; fi
|
|
|
e9ad7a |
- if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); else true; fi
|
|
|
e9ad7a |
- if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); else true; fi
|
|
|
e9ad7a |
- if [ ! -d $(MANDIR) ]; then mkdir $(MANDIR); else true; fi
|
|
|
e9ad7a |
- if [ ! -d $(INCDIR) ]; then mkdir $(INCDIR); else true; fi
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(BINDIR)/p2c: p2c
|
|
|
e9ad7a |
- $(COPY) p2c $(BINDIR)/p2c
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(BINDIR)/p2cc: p2cc
|
|
|
e9ad7a |
- $(COPY) p2cc $(BINDIR)/p2cc
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(LIBDIR)/libp2c.a: libp2c.a
|
|
|
e9ad7a |
- $(COPY) libp2c.a $(LIBDIR)/libp2c.a
|
|
|
e9ad7a |
- if [ -f /usr/bin/ranlib -o -f /bin/ranlib ]; then ranlib $(LIBDIR)/libp2c.a; fi
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(MANDIR)/p2c.1: $(MANFILE)
|
|
|
e9ad7a |
- $(COPY) $(MANFILE) $(MANDIR)/p2c.1
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(INCDIR)/p2c.h: p2c.h
|
|
|
e9ad7a |
- $(COPY) p2c.h $(INCDIR)/p2c.h
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(HOMEDIR)/p2crc: sys.p2crc
|
|
|
e9ad7a |
- $(COPY) sys.p2crc $(HOMEDIR)/p2crc
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(HOMEDIR)/loc.p2crc: loc.p2crc
|
|
|
e9ad7a |
- $(COPY) loc.p2crc $(HOMEDIR)/loc.p2crc
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(HOMEDIR)/system.imp: system.imp
|
|
|
e9ad7a |
- $(COPY) system.imp $(HOMEDIR)/system.imp
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(HOMEDIR)/system.m2: system.m2
|
|
|
e9ad7a |
- $(COPY) system.m2 $(HOMEDIR)/system.m2
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(HOMEDIR)/turbo.imp: turbo.imp
|
|
|
e9ad7a |
- $(COPY) turbo.imp $(HOMEDIR)/turbo.imp
|
|
|
e9ad7a |
-
|
|
|
e9ad7a |
-$(HOMEDIR)/string.pas: string.pas
|
|
|
e9ad7a |
- $(COPY) string.pas $(HOMEDIR)/string.pas
|
|
|
e9ad7a |
+install:
|
|
|
e9ad7a |
+ if [ ! -d $(DESTDIR)$(HOMEDIR) ]; then mkdir $(DESTDIR)$(HOMEDIR); else true; fi
|
|
|
e9ad7a |
+ if [ ! -d $(DESTDIR)$(BINDIR) ]; then mkdir $(DESTDIR)$(BINDIR); else true; fi
|
|
|
e9ad7a |
+ if [ ! -d $(DESTDIR)$(LIBDIR) ]; then mkdir $(DESTDIR)$(LIBDIR); else true; fi
|
|
|
e9ad7a |
+ if [ ! -d $(DESTDIR)$(MANDIR) ]; then mkdir $(DESTDIR)$(MANDIR); else true; fi
|
|
|
e9ad7a |
+ if [ ! -d $(DESTDIR)$(INCDIR) ]; then mkdir $(DESTDIR)$(INCDIR); else true; fi
|
|
|
e9ad7a |
+ $(COPY) p2c $(DESTDIR)$(BINDIR)/p2c
|
|
|
e9ad7a |
+ $(COPY) libp2c.a $(DESTDIR)$(LIBDIR)/libp2c.a
|
|
|
e9ad7a |
+ $(AR) -s $(DESTDIR)$(LIBDIR)/libp2c.a
|
|
|
e9ad7a |
+ $(COPY) $(MANFILE) $(DESTDIR)$(MANDIR)/p2c.1
|
|
|
e9ad7a |
+ $(COPY) p2c.h $(DESTDIR)$(INCDIR)/p2c.h
|
|
|
e9ad7a |
+ $(COPY) sys.p2crc $(DESTDIR)$(HOMEDIR)/p2crc
|
|
|
e9ad7a |
+ $(COPY) loc.p2crc $(DESTDIR)$(HOMEDIR)/loc.p2crc
|
|
|
e9ad7a |
+ $(COPY) system.imp $(DESTDIR)$(HOMEDIR)/system.imp
|
|
|
e9ad7a |
+ $(COPY) system.m2 $(DESTDIR)$(HOMEDIR)/system.m2
|
|
|
e9ad7a |
+ $(COPY) turbo.imp $(DESTDIR)$(HOMEDIR)/turbo.imp
|
|
|
e9ad7a |
+ $(COPY) string.pas $(DESTDIR)$(HOMEDIR)/string.pas
|
|
|
e9ad7a |
|
|
|
e9ad7a |
|
|
|
e9ad7a |
|
|
|
e9ad7a |
diff -ru p2c-2.02.orig/src/stuff.c p2c-2.02/src/stuff.c
|
|
|
e9ad7a |
--- p2c-2.02.orig/src/stuff.c 1993-12-08 06:36:48.000000000 +0100
|
|
|
e9ad7a |
+++ p2c-2.02/src/stuff.c 2024-03-20 10:43:13.059760161 +0100
|
|
|
e9ad7a |
@@ -316,7 +316,7 @@
|
|
|
e9ad7a |
cp = my_strrchr(fn, '.');
|
|
|
e9ad7a |
if (!cp)
|
|
|
e9ad7a |
return;
|
|
|
e9ad7a |
-#if defined(unix) || defined(__unix)
|
|
|
e9ad7a |
+#if defined(unix) || defined(__unix) || defined(__midipix__)
|
|
|
e9ad7a |
cp2 = my_strrchr(fn, '/');
|
|
|
e9ad7a |
if (cp2 && cp < cp2)
|
|
|
e9ad7a |
return;
|
|
|
e9ad7a |
diff -ru p2c-2.02.orig/src/trans.c p2c-2.02/src/trans.c
|
|
|
e9ad7a |
--- p2c-2.02.orig/src/trans.c 2015-10-02 19:52:53.000000000 +0200
|
|
|
e9ad7a |
+++ p2c-2.02/src/trans.c 2024-03-20 10:45:31.173956389 +0100
|
|
|
e9ad7a |
@@ -558,7 +558,7 @@
|
|
|
e9ad7a |
void saveoldfile(fname)
|
|
|
e9ad7a |
char *fname;
|
|
|
e9ad7a |
{
|
|
|
e9ad7a |
-#if defined(unix) || defined(__unix) || defined(CAN_LINK)
|
|
|
e9ad7a |
+#if defined(unix) || defined(__unix) || defined(CAN_LINK) || defined(__midipix__)
|
|
|
e9ad7a |
(void) unlink(format_s("%s~", fname));
|
|
|
e9ad7a |
if (link(fname, format_s("%s~", fname)) == 0)
|
|
|
e9ad7a |
(void) unlink(fname);
|