File: MPWMake

package info (click to toggle)
fpc 3.2.2%2Bdfsg-48
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 341,456 kB
  • sloc: pascal: 3,820,194; xml: 194,356; ansic: 9,637; asm: 8,482; java: 5,346; sh: 4,813; yacc: 3,956; makefile: 2,705; lex: 2,661; javascript: 2,454; sql: 929; php: 474; cpp: 145; perl: 136; sed: 132; csh: 34; tcl: 7
file content (184 lines) | stat: -rw-r--r-- 4,912 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Make file for MPW make.
# To run it, use:
#   Make <target> -f MPWMake > Makeout ; Makeout
# where <target> should be replaced with actual make target.

#Possible options:

DOTEST = :utils:DoTest

FPC = ppcppc
#OPT

TEST_FPC = ::compiler:ppcppc
TEST_OS_TARGET = macos
TEST_CPU_TARGET = powerpc
TEST_FULL_TARGET = {TEST_CPU_TARGET}-{TEST_OS_TARGET}
#TEST_OPT
# Target dir where the ppu and binaries are created:
TEST_OUTPUTDIR = :output:{TEST_FULL_TARGET}

TESTSUBDIRS = : :cg: :cg:cdecl: :units:system: :units:dos: :units:crt: :units:objects: :units:strings: :units:sysutils: :units:math:

DIRS = :webtbs: :webtbf: :tbs: :tbf: :test: :test:cg: :test:cg:cdecl: :test:units:system: :test:units:dos: :test:units:crt: :test:units:objects: :test:units:strings: :test:units:sysutils: :test:units:math:

################################
# Utilities
#
:utils:dotest  :utils:dotest.pp :utils:redir.pp
	"{FPC}" -WT "{OPT}" -FE:utils: :utils:dotest.pp

:utils:digest  :utils:digest.pp
	"{FPC}" -WT "{OPT}" -FE:utils: :utils:digest.pp

:utils:fail  :utils:fail.pp
	"{FPC}" -WT "{OPT}" -FE:utils: :utils:fail.pp

:utils:testfail  :utils:testfail.pp
	"{FPC}" -WT "{OPT}" -FE:utils: :utils:testfail.pp

utils 
	Set Exit 0
	Set isMade ''
	Set isMade :utils:fpcmade. > Dev:Null
	Set Exit 1
	If "{isMade}" == ':utils:fpcmade.powerpc-macos'
  	#Echo utils macos made
	Else If "{isMade}" == ''
		#Echo utils not made
		Make utilsbuild -f MPWMake > Makeout2 ; Makeout2
	Else
		#Echo utils made by other
		Make clean_utils -f MPWMake > Makeout2 ; Makeout2		
		Make utilsbuild -f MPWMake > Makeout2 ; Makeout2
	End

utilsbuild  :utils:dotest :utils:digest :utils:fail :utils:testfail
	Echo Compiled > :utils:fpcmade.powerpc-macos

################################
# Units
#

units 
	Set TEMP_FPC `Files -f "{TEST_FPC}"`
  Directory :units:
	Make all -f MPWMake -d FPC={TEMP_FPC} -d OPT={TEST_OPT} > Makeout ; Makeout
	Directory ::

################################
# Copy test environment dependent files ctest.o to test/cg etc
#

copyfiles  {TEST_OUTPUTDIR}
	Duplicate -y :test:cg:obj:{TEST_OS_TARGET}:{TEST_CPU_TARGET}:ctest.o :test:cg
	Set Exit 0
	NewFolder {TEST_OUTPUTDIR}:test
	NewFolder {TEST_OUTPUTDIR}:test:units
	NewFolder {TEST_OUTPUTDIR}:test:units:system
	Set Exit 1
	Duplicate -y :test:units:system:test.txt {TEST_OUTPUTDIR}:test:units:system

################################
# Preparation for tests
#

testprep  testprep-stamp.{TEST_FULL_TARGET}

testprep-stamp.{TEST_FULL_TARGET}  {TEST_OUTPUTDIR} utils units copyfiles
	Echo `Date` > testprep-stamp.{TEST_FULL_TARGET}

{TEST_OUTPUTDIR} 
	Set Exit 0
	NewFolder :output
	NewFolder {TEST_OUTPUTDIR}
	Set Exit 1

################################
# Dotest options
#

################################
# Run tests
#
# Because MPW Make lacks some features, it has to be done as below:
#

allexectest allexectbs allexectbf allexecwebtbs allexecwebtbf  testprep
	(Evaluate "{Targ}" =~ /allexec()1/) > Dev:Null
	#Assembles, links and run tests of FreePascal
	Set testdir ":{1}"
	#Iterate through tests
	If {testdir} == :test
		Set subdirlist "{TESTSUBDIRS}"
	Else
		Set subdirlist :
	End
	Set Exit 0 # To handle the case, in the for stmt, when there is no match
	#
	For subdir In {subdirlist}
		For sourceWithExt In {testdir}{subdir}t.pp  #only test files, which begins with a 't'
			Set Exit 1 #Revert error handling
			#
			(Evaluate "{sourceWithExt}" =~ /(([.])*)1/) > Dev:Null
			Set apppath {1}
			(Evaluate "{apppath}" =~ /:([:]*)1/) > Dev:Null
			Set appname {1}
			#
			If NOT "`Exists :output:powerpc-macos{apppath}.elg`"
				# Compile and perform the test 
				Echo Testing: "{apppath}"
				:utils:DoTest {DOTESTOPT} -E -X -C{TEST_FPC} "{apppath}.pp"
			End
			Set Exit 0 # To handle the case, in the for stmt, when there is no match
		End
	End
	Set Exit 1 #Revert error handling

allexectests  allexectest allexectbs allexectbf allexecwebtbs allexecwebtbf

################################
# Clean
#

clean_test 
	Set Exit 0 # To handle the case, when there is no match
	#
	Delete -y -i {TEST_OUTPUTDIR}
	#
	Delete -y -i test.txt .tmp core
	#Delete -y  #TODO shared library extension 
	Delete -y -i ppas gmon.out testprep-stamp.*
	Delete -y -i _ppas
	#
	Set Exit 1 #Revert error handling

clean  clean_test
  Directory :units
	Make clean -f MPWMake > Makeout; Makeout
  Directory ::

clean_utils 
	Set Exit 0 # To handle the case, when there is no match
	Delete -y :utils:fpcmade.
	Delete -y :utils:dotest :utils:digest :utils:fail :utils:testfail
	Delete -y :utils:.o :utils:.ppu :utils:.xcoff
	Set Exit 1 #Revert error handling

distclean  clean clean_utils

cleanall  clean clean_utils
#  Directory :utils
#	Make cleanall -f MPWMake > Makeout; Makeout
#  Directory ::

################################
# Main rules
#

digest  utils
	:utils:digest {TEST_OUTPUTDIR}:log

all  allexectests

full  clean allexectests digest