summaryrefslogtreecommitdiff
path: root/plan9/mkfile
blob: eeeb045a4b6795d27887da01526d1d151d92cbfc (plain)
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
APE=/sys/src/ape
< $APE/config
<plan9/buildinfo
sourcedir = /sys/src/cmd/perl/$p9pvers
archname = plan9_$objtype
privlib=/sys/lib/perl
archlib = /$objtype/lib/perl/$p9pvers
sitelib = $privlib/site_perl
sitearch = $archlib/site_perl

CFLAGS =  -B  -D_POSIX_SOURCE -D_BSD_EXTENSION -DNO_EMBED
LDFLAGS = -B 

CCCMD = $CC  -c $CFLAGS 

perllib = $archlib/CORE/libperl.a

perlshr = $archlib/CORE/libperlshr.a

installman1dir = /sys/man/1
installman3dir = /sys/man/2

podnames = perl perlbook perlbot perlcall perldata perldebug perldiag perldsc perlembed perlform perlfunc perlguts perlipc perllol perlmod perlobj perlop perlovl perlpod perlre perlref perlrun perlsec perlstyle perlsub perlsyn perltie perltoc perltrap perlvar perlxs perlxstut

libpods = ${podnames:%=pod/%.pod}

perlpods = $libpods

extensions = IO Socket Opcode DynaLoader Fcntl FileHandle POSIX
ext_xs = IO.xs Socket.xs Opcode.xs  dl_none.xs Fcntl.xs FileHandle.xs POSIX.xs
ext_c = ${ext_xs:%.xs=%.c}
ext_obj = ${ext_xs:%.xs=%.$O}

obj = gv.$O toke.$O perly.$O op.$O regcomp.$O dump.$O util.$O mg.$O  hv.$O av.$O run.$O pp_hot.$O sv.$O pp.$O scope.$O pp_ctl.$O pp_sys.$O doop.$O doio.$O regexec.$O taint.$O deb.$O globals.$O plan9.$O universal.$O perlio.$O

OBJS = perl.$O $obj

testlist = base/*.t comp/*.t cmd/*.t io/*.t op/*.t

install:V:	perl preplibrary 
		cp perl /$objtype/bin/perl
		cp plan9/aperl /rc/bin/aperl
		
perl:		config.h miniperlmain.$O miniperl $archlib/Config.pm perlmain.$O $perlshr 
		$LD $CFLAGS -o perl perlmain.$O $perllib $perlshr
		
miniperl:	config.h $perllib miniperlmain.$O 
		$LD  $CFLAGS -o miniperl miniperlmain.$O  $perllib 

preplibrary:V:	miniperl $archlib/Config.pm
			cd $privlib
			for (file in *.pm */*.pm $archlib/Config.pm) $sourcedir/miniperl  -e 'use AutoSplit; autosplit(@ARGV)' $file $privlib/auto
	
$perllib(%):N:	%
$perllib: ${OBJS:%=$perllib(%)}
		ar rv $perllib $OBJS
		$RANLIB $perllib
			
miniperlmain.$O:	config.h 
				$CCCMD miniperlmain.c

perlmain.$O:	config.h perlmain.c
			$CCCMD perlmain.c

perlmain.c:	miniperl vms/writemain.pl
			./miniperl vms/writemain.pl $extensions

config.h:		plan9/fndvers
			plan9/fndvers 
			cp config.h $archlib/CORE

$perlshr(%):N:	%
$perlshr:  ${ext_obj:%=$perlshr(%)}
		ar rv $perlshr $ext_obj
		$RANLIB $perlshr

IO.c:		miniperl ext/IO/IO.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/IO/IO.xs > $target
			cp ext/IO/*.pm $privlib
			if (test !-d $privlib/IO) { 
			mkdir $privlib/IO
			cp ext/IO/lib/IO/*.pm $privlib/IO
			 }

Socket.$O:	config.h Socket.c
			$CCCMD -I plan9 Socket.c

Socket.c:		miniperl ext/Socket/Socket.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/Socket/Socket.xs > $target
			cp ext/Socket/Socket.pm $privlib

Opcode.c:		miniperl ext/Opcode/Opcode.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/Opcode/Opcode.xs > $target
			cp ext/Opcode/*.pm $privlib

Fcntl.c:		miniperl ext/Fcntl/Fcntl.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/Fcntl/Fcntl.xs > $target
			cp ext/Fcntl/Fcntl.pm $privlib

FileHandle.c:		miniperl ext/FileHandle/FileHandle.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/FileHandle/FileHandle.xs > $target
			cp ext/FileHandle/FileHandle.pm $privlib

POSIX.c:		miniperl ext/POSIX/POSIX.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/POSIX/POSIX.xs > $target
			cp ext/POSIX/POSIX.pm $privlib

dl_none.c:	miniperl ext/DynaLoader/dl_none.xs
			./miniperl $privlib/ExtUtils/xsubpp -noprototypes -typemap $privlib/ExtUtils/typemap ext/DynaLoader/dl_none.xs > $target
			cp ext/DynaLoader/DynaLoader.pm $privlib

test:V:		
			bind -b $privlib $sourcedir/lib
			bind -b $archlib $sourcedir/lib
			cd $sourcedir/t
			rm -f perl
			cp /$objtype/bin/perl $sourcedir/t
			perl TEST `{ ls */*.t | comm -23 - ../plan9/exclude }

plan9.$O:	config.h ./plan9/plan9.c
			cp ./plan9/plan9.c ./plan9.c
			$CCCMD plan9.c

%.$O:	config.h %.c
		$CCCMD $stem.c

$archlib/Config.pm:		miniperl config.sh
				./miniperl configpm $archlib/Config.pm

config.sh:	miniperl config.h
		./miniperl ./plan9/genconfig.pl

installall:V:	
			for (objtype in 386 mips 68020 sparc) mk install

man:V:		$perlpods pod/pod2man.PL perl
			perl pod/pod2man.PL
			for (i in $podnames) pod/pod2man pod/$i.pod > $installman3dir/$i
			pod/pod2man plan9/perlplan9.pod > $installman3dir/perlplan9
			
nuke clean:V:	
		rm -f *.$O   $extensions^.pm config.sh $perllib config.h $perlshr perlmain.c perl miniperl $archlib/Config.pm $ext_c
		rm -rf $privlib/IO

deleteman:V:
			rm -f $installman1dir/perl* $installman3dir/perl*