1#!/usr/local/bin/perl 2# VC-CE.pl - the file for eMbedded Visual C++ 3.0 for windows CE, static libraries 3# 4 5$ssl= "ssleay32"; 6$crypto="libeay32"; 7$RSAref="RSAref32"; 8 9$o='\\'; 10$cp='copy nul+'; # Timestamps get stuffed otherwise 11$rm='del'; 12 13# C compiler stuff 14$cc='$(CC)'; 15$cflags=' /W3 /WX /Ox /O2 /Ob2 /Gs0 /GF /Gy /nologo $(WCETARGETDEFS) -DUNICODE -D_UNICODE -DWIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -I$(WCECOMPAT)/include'; 16$lflags='/nologo /subsystem:windowsce,$(WCELDVERSION) /machine:$(WCELDMACHINE) /opt:ref'; 17$mlflags=''; 18 19$out_def='out32_$(TARGETCPU)'; 20$tmp_def='tmp32_$(TARGETCPU)'; 21$inc_def="inc32"; 22 23if ($debug) 24 { 25 $cflags=" /MDd /W3 /WX /Zi /Yd /Od /nologo -DWIN32 -D_DEBUG -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -DDEBUG -DDSO_WIN32"; 26 $lflags.=" /debug"; 27 $mlflags.=' /debug'; 28 } 29 30$obj='.obj'; 31$ofile="/Fo"; 32 33# EXE linking stuff 34$link="link"; 35$efile="/out:"; 36$exep='.exe'; 37if ($no_sock) 38 { $ex_libs=""; } 39else { $ex_libs='winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib $(WCELDFLAGS)'; } 40 41# static library stuff 42$mklib='lib'; 43$ranlib=''; 44$plib=""; 45$libp=".lib"; 46$shlibp=($shlib)?".dll":".lib"; 47$lfile='/out:'; 48 49$shlib_ex_obj=""; 50$app_ex_obj=""; 51$app_ex_obj=""; 52 53$bn_asm_obj=''; 54$bn_asm_src=''; 55$des_enc_obj=''; 56$des_enc_src=''; 57$bf_enc_obj=''; 58$bf_enc_src=''; 59 60if ($shlib) 61 { 62 $mlflags.=" $lflags /dll"; 63# $cflags =~ s| /MD| /MT|; 64 $lib_cflag=" -D_WINDLL -D_DLL"; 65 $out_def='out32dll_$(TARGETCPU)'; 66 $tmp_def='tmp32dll_$(TARGETCPU)'; 67 } 68 69$cflags.=" /Fd$out_def"; 70 71sub do_lib_rule 72 { 73 local($objs,$target,$name,$shlib)=@_; 74 local($ret,$Name); 75 76 $taget =~ s/\//$o/g if $o ne '/'; 77 ($Name=$name) =~ tr/a-z/A-Z/; 78 79# $target="\$(LIB_D)$o$target"; 80 $ret.="$target: $objs\n"; 81 if (!$shlib) 82 { 83# $ret.="\t\$(RM) \$(O_$Name)\n"; 84 $ex =' '; 85 $ret.="\t\$(MKLIB) $lfile$target @<<\n $objs $ex\n<<\n"; 86 } 87 else 88 { 89 local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; 90# $ex.=' winsock.lib coredll.lib $(WCECOMPAT)/lib/wcecompatex.lib'; 91 $ex.=' winsock.lib $(WCECOMPAT)/lib/wcecompatex.lib'; 92 $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; 93 } 94 $ret.="\n"; 95 return($ret); 96 } 97 98sub do_link_rule 99 { 100 local($target,$files,$dep_libs,$libs,$sha1file,$openssl)=@_; 101 local($ret,$_); 102 103 $file =~ s/\//$o/g if $o ne '/'; 104 $n=&bname($targer); 105 $ret.="$target: $files $dep_libs\n"; 106 $ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n"; 107 $ret.=" \$(APP_EX_OBJ) $files $libs\n<<\n"; 108 if (defined $sha1file) 109 { 110 $ret.=" $openssl sha1 -hmac etaonrishdlcupfm -binary $target > $sha1file"; 111 } 112 $ret.="\n"; 113 return($ret); 114 } 115 1161; 117