xref: /minix3/crypto/external/bsd/openssl/dist/util/pl/unix.pl (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc#!/usr/local/bin/perl
2*ebfedea0SLionel Sambuc#
3*ebfedea0SLionel Sambuc# unix.pl - the standard unix makefile stuff.
4*ebfedea0SLionel Sambuc#
5*ebfedea0SLionel Sambuc
6*ebfedea0SLionel Sambuc$o='/';
7*ebfedea0SLionel Sambuc$cp='/bin/cp';
8*ebfedea0SLionel Sambuc$rm='/bin/rm -f';
9*ebfedea0SLionel Sambuc
10*ebfedea0SLionel Sambuc# C compiler stuff
11*ebfedea0SLionel Sambuc
12*ebfedea0SLionel Sambucif ($gcc)
13*ebfedea0SLionel Sambuc	{
14*ebfedea0SLionel Sambuc	$cc='gcc';
15*ebfedea0SLionel Sambuc	if ($debug)
16*ebfedea0SLionel Sambuc		{ $cflags="-g2 -ggdb"; }
17*ebfedea0SLionel Sambuc	else
18*ebfedea0SLionel Sambuc		{ $cflags="-O3 -fomit-frame-pointer"; }
19*ebfedea0SLionel Sambuc	}
20*ebfedea0SLionel Sambucelse
21*ebfedea0SLionel Sambuc	{
22*ebfedea0SLionel Sambuc	$cc='cc';
23*ebfedea0SLionel Sambuc	if ($debug)
24*ebfedea0SLionel Sambuc		{ $cflags="-g"; }
25*ebfedea0SLionel Sambuc	else
26*ebfedea0SLionel Sambuc		{ $cflags="-O"; }
27*ebfedea0SLionel Sambuc	}
28*ebfedea0SLionel Sambuc$obj='.o';
29*ebfedea0SLionel Sambuc$ofile='-o ';
30*ebfedea0SLionel Sambuc
31*ebfedea0SLionel Sambuc# EXE linking stuff
32*ebfedea0SLionel Sambuc$link='${CC}';
33*ebfedea0SLionel Sambuc$lflags='${CFLAGS}';
34*ebfedea0SLionel Sambuc$efile='-o ';
35*ebfedea0SLionel Sambuc$exep='';
36*ebfedea0SLionel Sambuc$ex_libs="";
37*ebfedea0SLionel Sambuc
38*ebfedea0SLionel Sambuc# static library stuff
39*ebfedea0SLionel Sambuc$mklib='ar r';
40*ebfedea0SLionel Sambuc$mlflags='';
41*ebfedea0SLionel Sambuc$ranlib=&which("ranlib") or $ranlib="true";
42*ebfedea0SLionel Sambuc$plib='lib';
43*ebfedea0SLionel Sambuc$libp=".a";
44*ebfedea0SLionel Sambuc$shlibp=".a";
45*ebfedea0SLionel Sambuc$lfile='';
46*ebfedea0SLionel Sambuc
47*ebfedea0SLionel Sambuc$asm='as';
48*ebfedea0SLionel Sambuc$afile='-o ';
49*ebfedea0SLionel Sambuc$bn_asm_obj="";
50*ebfedea0SLionel Sambuc$bn_asm_src="";
51*ebfedea0SLionel Sambuc$des_enc_obj="";
52*ebfedea0SLionel Sambuc$des_enc_src="";
53*ebfedea0SLionel Sambuc$bf_enc_obj="";
54*ebfedea0SLionel Sambuc$bf_enc_src="";
55*ebfedea0SLionel Sambuc
56*ebfedea0SLionel Sambucsub do_lib_rule
57*ebfedea0SLionel Sambuc	{
58*ebfedea0SLionel Sambuc	local($obj,$target,$name,$shlib)=@_;
59*ebfedea0SLionel Sambuc	local($ret,$_,$Name);
60*ebfedea0SLionel Sambuc
61*ebfedea0SLionel Sambuc	$target =~ s/\//$o/g if $o ne '/';
62*ebfedea0SLionel Sambuc	$target="$target";
63*ebfedea0SLionel Sambuc	(Name=name) =~ tr/a-z/A-Z/;
64*ebfedea0SLionel Sambuc
65*ebfedea0SLionel Sambuc	$ret.="$target: \$(${Name}OBJ)\n";
66*ebfedea0SLionel Sambuc	$ret.="\t\$(RM) $target\n";
67*ebfedea0SLionel Sambuc	$ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
68*ebfedea0SLionel Sambuc	$ret.="\t\$(RANLIB) $target\n\n";
69*ebfedea0SLionel Sambuc	}
70*ebfedea0SLionel Sambuc
71*ebfedea0SLionel Sambucsub do_link_rule
72*ebfedea0SLionel Sambuc	{
73*ebfedea0SLionel Sambuc	local($target,$files,$dep_libs,$libs)=@_;
74*ebfedea0SLionel Sambuc	local($ret,$_);
75*ebfedea0SLionel Sambuc
76*ebfedea0SLionel Sambuc	$file =~ s/\//$o/g if $o ne '/';
77*ebfedea0SLionel Sambuc	$n=&bname($target);
78*ebfedea0SLionel Sambuc	$ret.="$target: $files $dep_libs\n";
79*ebfedea0SLionel Sambuc	$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n";
80*ebfedea0SLionel Sambuc	return($ret);
81*ebfedea0SLionel Sambuc	}
82*ebfedea0SLionel Sambuc
83*ebfedea0SLionel Sambucsub which
84*ebfedea0SLionel Sambuc	{
85*ebfedea0SLionel Sambuc	my ($name)=@_;
86*ebfedea0SLionel Sambuc	my $path;
87*ebfedea0SLionel Sambuc	foreach $path (split /:/, $ENV{PATH})
88*ebfedea0SLionel Sambuc		{
89*ebfedea0SLionel Sambuc		if (-x "$path/$name")
90*ebfedea0SLionel Sambuc			{
91*ebfedea0SLionel Sambuc			return "$path/$name";
92*ebfedea0SLionel Sambuc			}
93*ebfedea0SLionel Sambuc		}
94*ebfedea0SLionel Sambuc	}
95*ebfedea0SLionel Sambuc
96*ebfedea0SLionel Sambuc1;
97