1# 2# Compilers 3# 4CC?= cc 5CXX?= c++ 6CGANAL = cganal 7PTOC = ptoc 8 9# 10# Include files and libraries 11# 12PTOC_INC = -I/usr/local/include/ptoc 13PTOC_LIB = -L/usr/local/lib -lptoc 14BGI_LIB = -L/usr/local/lib -lXbgi 15GRAPH_LIB = -L/usr/X11R6/lib -lX11 16MATH_LIB = -lm 17 18EXE = hello_c hello_cxx impact war2 trinor tpascal set_c set_cxx lister polut2 vibrkinp vibrtabl bgidemo 19 20all: convert executable 21 22convert: hello.c hello.cxx impact.cxx war2.cxx test.c test.cxx polut2.cxx \ 23rename.cxx tpascal.cxx trinor.cxx lister.cxx vibrkinp.cxx vibrtabl.cxx bgidemo.cxx 24 25executable: $(EXE) 26 27# Hello world 28 29hello.c: hello.pas 30 $(PTOC) -c -in hello.pas 31 32hello.cxx: hello.pas 33 $(PTOC) -in hello.pas 34 35hello_c: hello.c 36 $(CC) $(PTOC_INC) -o hello_c hello.c $(PTOC_LIB) 37 38hello_cxx: hello.cxx 39 $(CXX) $(PTOC_INC) -o hello_cxx hello.cxx $(PTOC_LIB) 40 41#---------------------------------------------------------------- 42# Graphic example: BGIDEMO 43#---------------------------------------------------------------- 44bgidemo.cxx: bgidemo.pas 45 $(PTOC) -turbo -preserve -analyze -in bgidemo.pas 46 47bgidemo: bgidemo.cxx 48 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -funsigned-char -o bgidemo bgidemo.cxx $(PTOC_LIB) $(BGI_LIB) $(GRAPH_LIB) $(MATH_LIB) 49 50#---------------------------------------------------------------- 51# Some numeric programs for Turbo Pascal 52#---------------------------------------------------------------- 53 54# Examples with BGI 55vibrtabl.cxx: vibrtabl.pas 56 $(PTOC) -turbo -in vibrtabl.pas 57 58vibrtabl: vibrtabl.cxx 59 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -o vibrtabl vibrtabl.cxx $(PTOC_LIB) $(BGI_LIB) $(GRAPH_LIB) $(MATH_LIB) 60 61 62vibrkinp.cxx: vibrkinp.pas 63 $(PTOC) -turbo -in vibrkinp.pas 64 65vibrkinp: vibrkinp.cxx 66 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -o vibrkinp vibrkinp.cxx $(PTOC_LIB) $(BGI_LIB) $(GRAPH_LIB) $(MATH_LIB) 67 68 69polut2.cxx: polut2.pas 70 $(PTOC) -turbo -in polut2.pas 71 72polut2: polut2.cxx 73 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -o polut2 polut2.cxx $(PTOC_LIB) $(BGI_LIB) $(GRAPH_LIB) $(MATH_LIB) 74 75 76impact.cxx: impact.pas 77 $(PTOC) -turbo -in impact.pas 78 79impact: impact.cxx 80 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -o impact impact.cxx $(PTOC_LIB) $(MATH_LIB) 81 82trinor.cxx: trinor.pas 83 $(PTOC) -turbo -in trinor.pas 84 85trinor: trinor.cxx 86 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -o trinor trinor.cxx $(PTOC_LIB) $(MATH_LIB) 87 88 89war2.cxx: war2.pas 90 $(PTOC) -turbo -in war2.pas 91 92war2: war2.cxx 93 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -o war2 war2.cxx $(PTOC_LIB) $(MATH_LIB) 94# This program reads data from files war2.txt, random.txt, coord.txt 95# and produce file xy2.txt. Your can compare this file with xy2orig.txt 96# produced by original Pascal program. 97 98#------------------------------------------------------------------- 99# File from examples to Borland Pascal. 100#------------------------------------------------------------------- 101 102lister.cxx: lister.pas 103 $(PTOC) -turbo -init -in lister.pas 104 105printer.cxx: printer.pas 106 $(PTOC) -turbo -init -in printer.pas 107 108lister: lister.cxx printer.cxx 109 $(CXX) $(PTOC_INC) -DTURBO_PASCAL -o lister lister.cxx printer.cxx $(PTOC_LIB) 110 111#------------------------------------------------------------------- 112# Some tests for converter. This programms produce dummy output. 113#------------------------------------------------------------------- 114 115test.c: test.pas 116 rm -f call.grp 117 $(PTOC) -c -analyze -smallenum -intset -in test.pas 118 $(CGANAL) 119 $(PTOC) -c -analyze -smallenum -intset -in test.pas 120# It is neccessary to run converter twice. 121# At first phase call graph of functions is constructed and 122# at second phase correct code is generated. 123 124test.cxx: test.pas 125 rm -f call.grp 126 $(PTOC) -analyze -in test.pas 127 $(CGANAL) 128 $(PTOC) -analyze -in test.pas 129 130rename.cxx: rename.pas 131 $(PTOC) -in rename.pas 132 133set.cxx: set.pas 134 $(PTOC) -in set.pas 135 136set.c: set.pas 137 $(PTOC) -c -intset -in set.pas 138 139set_cxx: set.cxx 140 $(CXX) $(PTOC_INC) -o set_cxx set.cxx $(PTOC_LIB) 141 142set_c: set.c 143 $(CC) $(PTOC_INC) -o set_c set.c $(PTOC_LIB) 144 145# Test for Turbo Pascal 146 147tpascal.cxx: tpascal.pas 148 $(PTOC) -turbo -cstring -in tpascal.pas 149 150tpascal: tpascal.cxx 151 $(CXX) $(PTOC_INC) -o tpascal -DTURBO_PASCAL tpascal.cxx $(PTOC_LIB) 152 153 154# 155# Erase intermediate files after generating binaries 156# 157 158clean: 159 rm -f $(EXE) $(convert) *~ *.o *.core call.grp recur.prc \ 160 hello.c hello.cxx impact.cxx war2.cxx trinor.cxx tpascal.cxx \ 161 set.c set.cxx lister.cxx polut2.cxx vibrkinp.cxx vibrtabl.cxx \ 162 bgidemo.cxx printer.cxx printer.h 163 164