From: Gurusamy Sarathy Date: Mon, 16 Mar 1998 08:44:37 +0000 (+0000) Subject: [asperl] various changes to get asperl working under Borland X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ac4c12e7aee90d31d5da776601addbfd9d738a5a;p=p5sagit%2Fp5-mst-13.2.git [asperl] various changes to get asperl working under Borland (passes all tests when built under PERL_OBJECT) p4raw-id: //depot/asperl@809 --- diff --git a/ObjXSub.h b/ObjXSub.h index c0a9c9b..dca17e5 100644 --- a/ObjXSub.h +++ b/ObjXSub.h @@ -828,6 +828,8 @@ #define cv_undef pPerl->Perl_cv_undef #undef cxinc #define cxinc pPerl->Perl_cxinc +#undef deb +#define deb pPerl->Perl_deb #undef delimcpy #define delimcpy pPerl->Perl_delimcpy #undef deprecate @@ -1804,6 +1806,9 @@ #undef ioctl #undef getlogin #undef setjmp +#undef getc +#undef ungetc +#undef fileno #define mkdir PerlDir_mkdir #define chdir PerlDir_chdir @@ -1946,11 +1951,16 @@ #define THIS_ pPerl, #undef SAVEDESTRUCTOR -#define SAVEDESTRUCTOR(f,p) pPerl->Perl_save_destructor((f),(p)) +#define SAVEDESTRUCTOR(f,p) \ + pPerl->Perl_save_destructor((FUNC_NAME_TO_PTR(f)),(p)) #ifdef WIN32 -#undef errno -#define errno ErrorNo() + +#ifndef WIN32IO_IS_STDIO +#undef errno +#define errno ErrorNo() +#endif + #undef ErrorNo #define ErrorNo pPerl->ErrorNo #undef NtCrypt diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index a7b9c6d..559d384 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -201,8 +201,13 @@ opmask_addlocal(SV *opset, char *op_mask_buf) /* Localise op_mask then opmask_ad { char *orig_op_mask = op_mask; SAVEPPTR(op_mask); +#if !(defined(PERL_OBJECT) && defined(__BORLANDC__)) + /* XXX casting to an ordinary function ptr from a member function ptr + * is disallowed by Borland + */ if (opcode_debug >= 2) SAVEDESTRUCTOR((void(CPERLscope(*))_((void*)))warn,"op_mask restored"); +#endif op_mask = &op_mask_buf[0]; if (orig_op_mask) Copy(orig_op_mask, op_mask, maxo, char); diff --git a/globals.c b/globals.c index fc75a79..53750a6 100644 --- a/globals.c +++ b/globals.c @@ -1443,7 +1443,7 @@ CPerlObj::Init(void) #endif maxo = MAXO; sh_path = SH_PATH; - runops = RUNOPS_DEFAULT; + runops = FUNC_NAME_TO_PTR(RUNOPS_DEFAULT); #ifdef CSH cshname = CSH; #endif diff --git a/mg.c b/mg.c index 29fe0a4..6466b31 100644 --- a/mg.c +++ b/mg.c @@ -289,18 +289,18 @@ magic_len(SV *sv, MAGIC *mg) register I32 paren; register char *s; register I32 i; - register REGEXP *rx; + register REGEXP *prx; char *t; switch (*mg->mg_ptr) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '&': - if (curpm && (rx = curpm->op_pmregexp)) { + if (curpm && (prx = curpm->op_pmregexp)) { paren = atoi(mg->mg_ptr); getparen: - if (paren <= rx->nparens && - (s = rx->startp[paren]) && - (t = rx->endp[paren])) + if (paren <= prx->nparens && + (s = prx->startp[paren]) && + (t = prx->endp[paren])) { i = t - s; if (i >= 0) @@ -309,25 +309,25 @@ magic_len(SV *sv, MAGIC *mg) } return 0; case '+': - if (curpm && (rx = curpm->op_pmregexp)) { - paren = rx->lastparen; + if (curpm && (prx = curpm->op_pmregexp)) { + paren = prx->lastparen; if (paren) goto getparen; } return 0; case '`': - if (curpm && (rx = curpm->op_pmregexp)) { - if ((s = rx->subbeg) && rx->startp[0]) { - i = rx->startp[0] - s; + if (curpm && (prx = curpm->op_pmregexp)) { + if ((s = prx->subbeg) && prx->startp[0]) { + i = prx->startp[0] - s; if (i >= 0) return i; } } return 0; case '\'': - if (curpm && (rx = curpm->op_pmregexp)) { - if (rx->subend && (s = rx->endp[0])) { - i = rx->subend - s; + if (curpm && (prx = curpm->op_pmregexp)) { + if (prx->subend && (s = prx->endp[0])) { + i = prx->subend - s; if (i >= 0) return i; } @@ -353,7 +353,7 @@ magic_get(SV *sv, MAGIC *mg) register I32 paren; register char *s; register I32 i; - register REGEXP *rx; + register REGEXP *prx; char *t; switch (*mg->mg_ptr) { @@ -457,16 +457,16 @@ magic_get(SV *sv, MAGIC *mg) break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '&': - if (curpm && (rx = curpm->op_pmregexp)) { + if (curpm && (prx = curpm->op_pmregexp)) { /* * Pre-threads, this was paren = atoi(GvENAME((GV*)mg->mg_obj)); * XXX Does the new way break anything? */ paren = atoi(mg->mg_ptr); getparen: - if (paren <= rx->nparens && - (s = rx->startp[paren]) && - (t = rx->endp[paren])) + if (paren <= prx->nparens && + (s = prx->startp[paren]) && + (t = prx->endp[paren])) { i = t - s; getrx: @@ -478,7 +478,7 @@ magic_get(SV *sv, MAGIC *mg) } sv_setpvn(sv,s,i); if (tainting) - tainted = was_tainted || RX_MATCH_TAINTED(rx); + tainted = was_tainted || RX_MATCH_TAINTED(prx); break; } } @@ -486,26 +486,26 @@ magic_get(SV *sv, MAGIC *mg) sv_setsv(sv,&sv_undef); break; case '+': - if (curpm && (rx = curpm->op_pmregexp)) { - paren = rx->lastparen; + if (curpm && (prx = curpm->op_pmregexp)) { + paren = prx->lastparen; if (paren) goto getparen; } sv_setsv(sv,&sv_undef); break; case '`': - if (curpm && (rx = curpm->op_pmregexp)) { - if ((s = rx->subbeg) && rx->startp[0]) { - i = rx->startp[0] - s; + if (curpm && (prx = curpm->op_pmregexp)) { + if ((s = prx->subbeg) && prx->startp[0]) { + i = prx->startp[0] - s; goto getrx; } } sv_setsv(sv,&sv_undef); break; case '\'': - if (curpm && (rx = curpm->op_pmregexp)) { - if (rx->subend && (s = rx->endp[0])) { - i = rx->subend - s; + if (curpm && (prx = curpm->op_pmregexp)) { + if (prx->subend && (s = prx->endp[0])) { + i = prx->subend - s; goto getrx; } } diff --git a/objpp.h b/objpp.h index b2dc52c..cdc6776 100644 --- a/objpp.h +++ b/objpp.h @@ -1428,7 +1428,7 @@ #define more_he CPerlObj::more_he #define del_he CPerlObj::del_he -#ifdef WIN32 +#if defined(WIN32) && !defined(WIN32IO_IS_STDIO) #undef errno #define errno CPerlObj::ErrorNo() diff --git a/op.c b/op.c index 86684e9..e7c5bd9 100644 --- a/op.c +++ b/op.c @@ -582,7 +582,8 @@ op_free(OP *o) break; #endif /* USE_THREADS */ default: - if (!(o->op_flags & OPf_REF) || (check[o->op_type] != ck_ftst)) + if (!(o->op_flags & OPf_REF) + || (check[o->op_type] != FUNC_NAME_TO_PTR(ck_ftst))) break; /* FALL THROUGH */ case OP_GVSV: diff --git a/perl.h b/perl.h index 3bb3c7d..f9528ee 100644 --- a/perl.h +++ b/perl.h @@ -1014,6 +1014,10 @@ typedef I32 (*filter_t) _((int, SV *, int)); # endif #endif +#ifndef FUNC_NAME_TO_PTR +#define FUNC_NAME_TO_PTR(name) name +#endif + /* * USE_THREADS needs to be after unixish.h as includes * which defines NSIG - which will stop inclusion of @@ -1840,9 +1844,6 @@ typedef void *Thread; #endif #ifdef PERL_OBJECT -#if defined(WIN32) -char** environ; -#endif }; #include "objpp.h" diff --git a/perly.c b/perly.c index 811acf0..ca55cb4 100644 --- a/perly.c +++ b/perly.c @@ -1380,7 +1380,7 @@ yyloop: yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; - fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate, + PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate, yychar, yys); } #endif @@ -1390,7 +1390,7 @@ yyloop: { #if YYDEBUG if (yydebug) - fprintf(stderr, "yydebug: state %d, shifting to state %d\n", + PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n", yystate, yytable[yyn]); #endif if (yyssp >= yyss + yystacksize - 1) @@ -1445,7 +1445,7 @@ yyinrecovery: { #if YYDEBUG if (yydebug) - fprintf(stderr, + PerlIO_printf(Perl_debug_log, "yydebug: state %d, error recovery shifting to state %d\n", *yyssp, yytable[yyn]); #endif @@ -1475,7 +1475,7 @@ yyinrecovery: { #if YYDEBUG if (yydebug) - fprintf(stderr, + PerlIO_printf(Perl_debug_log, "yydebug: error recovery discarding state %d\n", *yyssp); #endif @@ -1494,7 +1494,7 @@ yyinrecovery: yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; - fprintf(stderr, + PerlIO_printf(Perl_debug_log, "yydebug: state %d, error recovery discards token %d (%s)\n", yystate, yychar, yys); } @@ -1505,7 +1505,7 @@ yyinrecovery: yyreduce: #if YYDEBUG if (yydebug) - fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n", + PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n", yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; @@ -2300,7 +2300,7 @@ break; { #if YYDEBUG if (yydebug) - fprintf(stderr, + PerlIO_printf(Perl_debug_log, "yydebug: after reduction, shifting from state 0 to state %d\n", YYFINAL); #endif @@ -2316,7 +2316,7 @@ break; yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; - fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", + PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", YYFINAL, yychar, yys); } #endif @@ -2331,7 +2331,7 @@ break; yystate = yydgoto[yym]; #if YYDEBUG if (yydebug) - fprintf(stderr, + PerlIO_printf(Perl_debug_log, "yydebug: after reduction, shifting from state %d to state %d\n", *yyssp, yystate); #endif diff --git a/perly.c.diff b/perly.c.diff index e082aec..55f0a11 100644 --- a/perly.c.diff +++ b/perly.c.diff @@ -194,7 +194,7 @@ Index: perly.c --- 1372,1376 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; -! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate, +! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate, yychar, yys); } *************** @@ -212,7 +212,7 @@ Index: perly.c --- 1382,1405 ---- #if YYDEBUG if (yydebug) -! fprintf(stderr, "yydebug: state %d, shifting to state %d\n", +! PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n", yystate, yytable[yyn]); #endif if (yyssp >= yyss + yystacksize - 1) @@ -249,7 +249,7 @@ Index: perly.c --- 1437,1461 ---- #if YYDEBUG if (yydebug) -! fprintf(stderr, +! PerlIO_printf(Perl_debug_log, ! "yydebug: state %d, error recovery shifting to state %d\n", ! *yyssp, yytable[yyn]); #endif @@ -283,7 +283,7 @@ Index: perly.c --- 1467,1473 ---- #if YYDEBUG if (yydebug) -! fprintf(stderr, +! PerlIO_printf(Perl_debug_log, ! "yydebug: error recovery discarding state %d\n", ! *yyssp); #endif @@ -299,7 +299,7 @@ Index: perly.c --- 1486,1492 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; -! fprintf(stderr, +! PerlIO_printf(Perl_debug_log, ! "yydebug: state %d, error recovery discards token %d (%s)\n", ! yystate, yychar, yys); } @@ -314,7 +314,7 @@ Index: perly.c --- 1497,1501 ---- #if YYDEBUG if (yydebug) -! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n", +! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n", yystate, yyn, yyrule[yyn]); #endif *************** @@ -328,7 +328,7 @@ Index: perly.c --- 2292,2298 ---- #if YYDEBUG if (yydebug) -! fprintf(stderr, +! PerlIO_printf(Perl_debug_log, ! "yydebug: after reduction, shifting from state 0 to state %d\n", ! YYFINAL); #endif @@ -343,7 +343,7 @@ Index: perly.c --- 2308,2312 ---- if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; -! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", +! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", YYFINAL, yychar, yys); } *************** @@ -361,7 +361,7 @@ Index: perly.c --- 2323,2347 ---- #if YYDEBUG if (yydebug) -! fprintf(stderr, +! PerlIO_printf(Perl_debug_log, ! "yydebug: after reduction, shifting from state %d to state %d\n", ! *yyssp, yystate); #endif diff --git a/pp.c b/pp.c index affea17..390c501 100644 --- a/pp.c +++ b/pp.c @@ -4127,7 +4127,7 @@ PP(pp_split) register char *s = SvPV(sv, len); char *strend = s + len; register PMOP *pm; - register REGEXP *rx; + register REGEXP *prx; register SV *dstr; register char *m; I32 iters = 0; @@ -4150,7 +4150,7 @@ PP(pp_split) #endif if (!pm || !s) DIE("panic: do_split"); - rx = pm->op_pmregexp; + prx = pm->op_pmregexp; TAINT_IF((pm->op_pmflags & PMf_LOCALE) && (pm->op_pmflags & (PMf_WHITE | PMf_SKIPWHITE))); @@ -4228,7 +4228,7 @@ PP(pp_split) ++s; } } - else if (strEQ("^", rx->precomp)) { + else if (strEQ("^", prx->precomp)) { while (--limit) { /*SUPPRESS 530*/ for (m = s; m < strend && *m != '\n'; m++) ; @@ -4243,12 +4243,12 @@ PP(pp_split) s = m; } } - else if (rx->check_substr && !rx->nparens - && (rx->reganch & ROPT_CHECK_ALL) - && !(rx->reganch & ROPT_ANCH)) { - i = SvCUR(rx->check_substr); - if (i == 1 && !SvTAIL(rx->check_substr)) { - i = *SvPVX(rx->check_substr); + else if (prx->check_substr && !prx->nparens + && (prx->reganch & ROPT_CHECK_ALL) + && !(prx->reganch & ROPT_ANCH)) { + i = SvCUR(prx->check_substr); + if (i == 1 && !SvTAIL(prx->check_substr)) { + i = *SvPVX(prx->check_substr); while (--limit) { /*SUPPRESS 530*/ for (m = s; m < strend && *m != i; m++) ; @@ -4266,7 +4266,7 @@ PP(pp_split) #ifndef lint while (s < strend && --limit && (m=fbm_instr((unsigned char*)s, (unsigned char*)strend, - rx->check_substr)) ) + prx->check_substr)) ) #endif { dstr = NEWSV(31, m-s); @@ -4279,29 +4279,29 @@ PP(pp_split) } } else { - maxiters += (strend - s) * rx->nparens; + maxiters += (strend - s) * prx->nparens; while (s < strend && --limit && - regexec_flags(rx, s, strend, orig, 1, Nullsv, NULL, 0)) + regexec_flags(prx, s, strend, orig, 1, Nullsv, NULL, 0)) { - TAINT_IF(RX_MATCH_TAINTED(rx)); - if (rx->subbase - && rx->subbase != orig) { + TAINT_IF(RX_MATCH_TAINTED(prx)); + if (prx->subbase + && prx->subbase != orig) { m = s; s = orig; - orig = rx->subbase; + orig = prx->subbase; s = orig + (m - s); strend = s + (strend - m); } - m = rx->startp[0]; + m = prx->startp[0]; dstr = NEWSV(32, m-s); sv_setpvn(dstr, s, m-s); if (make_mortal) sv_2mortal(dstr); XPUSHs(dstr); - if (rx->nparens) { - for (i = 1; i <= rx->nparens; i++) { - s = rx->startp[i]; - m = rx->endp[i]; + if (prx->nparens) { + for (i = 1; i <= prx->nparens; i++) { + s = prx->startp[i]; + m = prx->endp[i]; if (m && s) { dstr = NEWSV(33, m-s); sv_setpvn(dstr, s, m-s); @@ -4313,7 +4313,7 @@ PP(pp_split) XPUSHs(dstr); } } - s = rx->endp[0]; + s = prx->endp[0]; } } diff --git a/pp_ctl.c b/pp_ctl.c index 67dea43..437ca07 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -126,9 +126,9 @@ PP(pp_substcont) register char *s = cx->sb_s; register char *m = cx->sb_m; char *orig = cx->sb_orig; - register REGEXP *rx = cx->sb_rx; + register REGEXP *prx = cx->sb_rx; - rxres_restore(&cx->sb_rxres, rx); + rxres_restore(&cx->sb_rxres, prx); if (cx->sb_iters++) { if (cx->sb_iters > cx->sb_maxiters) @@ -139,14 +139,14 @@ PP(pp_substcont) sv_catsv(dstr, POPs); /* Are we done */ - if (cx->sb_once || !regexec_flags(rx, s, cx->sb_strend, orig, + if (cx->sb_once || !regexec_flags(prx, s, cx->sb_strend, orig, s == m, Nullsv, NULL, cx->sb_safebase ? 0 : REXEC_COPY_STR)) { SV *targ = cx->sb_targ; sv_catpvn(dstr, s, cx->sb_strend - s); - TAINT_IF(cx->sb_rxtainted || RX_MATCH_TAINTED(rx)); + TAINT_IF(cx->sb_rxtainted || RX_MATCH_TAINTED(prx)); (void)SvOOK_off(targ); Safefree(SvPVX(targ)); @@ -165,29 +165,29 @@ PP(pp_substcont) RETURNOP(pm->op_next); } } - if (rx->subbase && rx->subbase != orig) { + if (prx->subbase && prx->subbase != orig) { m = s; s = orig; - cx->sb_orig = orig = rx->subbase; + cx->sb_orig = orig = prx->subbase; s = orig + (m - s); cx->sb_strend = s + (cx->sb_strend - m); } - cx->sb_m = m = rx->startp[0]; + cx->sb_m = m = prx->startp[0]; sv_catpvn(dstr, s, m-s); - cx->sb_s = rx->endp[0]; - cx->sb_rxtainted |= RX_MATCH_TAINTED(rx); - rxres_save(&cx->sb_rxres, rx); + cx->sb_s = prx->endp[0]; + cx->sb_rxtainted |= RX_MATCH_TAINTED(prx); + rxres_save(&cx->sb_rxres, prx); RETURNOP(pm->op_pmreplstart); } void -rxres_save(void **rsp, REGEXP *rx) +rxres_save(void **rsp, REGEXP *prx) { UV *p = (UV*)*rsp; U32 i; - if (!p || p[1] < rx->nparens) { - i = 6 + rx->nparens * 2; + if (!p || p[1] < prx->nparens) { + i = 6 + prx->nparens * 2; if (!p) New(501, p, i, UV); else @@ -195,36 +195,36 @@ rxres_save(void **rsp, REGEXP *rx) *rsp = (void*)p; } - *p++ = (UV)rx->subbase; - rx->subbase = Nullch; + *p++ = (UV)prx->subbase; + prx->subbase = Nullch; - *p++ = rx->nparens; + *p++ = prx->nparens; - *p++ = (UV)rx->subbeg; - *p++ = (UV)rx->subend; - for (i = 0; i <= rx->nparens; ++i) { - *p++ = (UV)rx->startp[i]; - *p++ = (UV)rx->endp[i]; + *p++ = (UV)prx->subbeg; + *p++ = (UV)prx->subend; + for (i = 0; i <= prx->nparens; ++i) { + *p++ = (UV)prx->startp[i]; + *p++ = (UV)prx->endp[i]; } } void -rxres_restore(void **rsp, REGEXP *rx) +rxres_restore(void **rsp, REGEXP *prx) { UV *p = (UV*)*rsp; U32 i; - Safefree(rx->subbase); - rx->subbase = (char*)(*p); + Safefree(prx->subbase); + prx->subbase = (char*)(*p); *p++ = 0; - rx->nparens = *p++; + prx->nparens = *p++; - rx->subbeg = (char*)(*p++); - rx->subend = (char*)(*p++); - for (i = 0; i <= rx->nparens; ++i) { - rx->startp[i] = (char*)(*p++); - rx->endp[i] = (char*)(*p++); + prx->subbeg = (char*)(*p++); + prx->subend = (char*)(*p++); + for (i = 0; i <= prx->nparens; ++i) { + prx->startp[i] = (char*)(*p++); + prx->endp[i] = (char*)(*p++); } } @@ -742,7 +742,7 @@ PP(pp_sort) (void)SvREFCNT_inc(cv); /* in preparation for POPSUB */ } sortcxix = cxstack_ix; - qsortsv((myorigmark+1), max, sortcv); + qsortsv((myorigmark+1), max, FUNC_NAME_TO_PTR(sortcv)); POPBLOCK(cx,curpm); SWITCHSTACK(sortstack, oldstack); @@ -754,7 +754,9 @@ PP(pp_sort) if (max > 1) { MEXTEND(SP, 20); /* Can't afford stack realloc on signal. */ qsortsv(ORIGMARK+1, max, - (op->op_private & OPpLOCALE) ? sv_cmp_locale : sv_cmp); + (op->op_private & OPpLOCALE) + ? FUNC_NAME_TO_PTR(sv_cmp_locale) + : FUNC_NAME_TO_PTR(sv_cmp)); } } stack_sp = ORIGMARK + max; diff --git a/pp_hot.c b/pp_hot.c index 32f378a..702e447 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -763,7 +763,7 @@ PP(pp_match) I32 global; I32 safebase; char *truebase; - register REGEXP *rx = pm->op_pmregexp; + register REGEXP *prx = pm->op_pmregexp; I32 gimme = GIMME; STRLEN len; I32 minmatch = 0; @@ -791,31 +791,31 @@ PP(pp_match) RETPUSHNO; } - if (!rx->prelen && curpm) { + if (!prx->prelen && curpm) { pm = curpm; - rx = pm->op_pmregexp; + prx = pm->op_pmregexp; } - if (rx->minlen > len) goto failure; + if (prx->minlen > len) goto failure; - screamer = ( (SvSCREAM(TARG) && rx->check_substr - && SvTYPE(rx->check_substr) == SVt_PVBM - && SvVALID(rx->check_substr)) + screamer = ( (SvSCREAM(TARG) && prx->check_substr + && SvTYPE(prx->check_substr) == SVt_PVBM + && SvVALID(prx->check_substr)) ? TARG : Nullsv); truebase = t = s; if (global = pm->op_pmflags & PMf_GLOBAL) { - rx->startp[0] = 0; + prx->startp[0] = 0; if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG)) { MAGIC* mg = mg_find(TARG, 'g'); if (mg && mg->mg_len >= 0) { - rx->endp[0] = rx->startp[0] = s + mg->mg_len; + prx->endp[0] = prx->startp[0] = s + mg->mg_len; minmatch = (mg->mg_flags & MGf_MINMATCH); update_minmatch = 0; } } } - if (!rx->nparens && !global) + if (!prx->nparens && !global) gimme = G_SCALAR; /* accidental array context? */ - safebase = (((gimme == G_ARRAY) || global || !rx->nparens) + safebase = (((gimme == G_ARRAY) || global || !prx->nparens) && !sawampersand); safebase = safebase ? 0 : REXEC_COPY_STR ; if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) { @@ -824,36 +824,36 @@ PP(pp_match) } play_it_again: - if (global && rx->startp[0]) { - t = s = rx->endp[0]; - if ((s + rx->minlen) > strend) + if (global && prx->startp[0]) { + t = s = prx->endp[0]; + if ((s + prx->minlen) > strend) goto nope; if (update_minmatch++) - minmatch = (s == rx->startp[0]); + minmatch = (s == prx->startp[0]); } - if (rx->check_substr) { - if (!(rx->reganch & ROPT_NOSCAN)) { /* Floating checkstring. */ + if (prx->check_substr) { + if (!(prx->reganch & ROPT_NOSCAN)) { /* Floating checkstring. */ if ( screamer ) { I32 p = -1; - if (screamfirst[BmRARE(rx->check_substr)] < 0) + if (screamfirst[BmRARE(prx->check_substr)] < 0) goto nope; - else if (!(s = screaminstr(TARG, rx->check_substr, - rx->check_offset_min, 0, &p, 0))) + else if (!(s = screaminstr(TARG, prx->check_substr, + prx->check_offset_min, 0, &p, 0))) goto nope; - else if ((rx->reganch & ROPT_CHECK_ALL) - && !sawampersand && !SvTAIL(rx->check_substr)) + else if ((prx->reganch & ROPT_CHECK_ALL) + && !sawampersand && !SvTAIL(prx->check_substr)) goto yup; } - else if (!(s = fbm_instr((unsigned char*)s + rx->check_offset_min, + else if (!(s = fbm_instr((unsigned char*)s + prx->check_offset_min, (unsigned char*)strend, - rx->check_substr))) + prx->check_substr))) goto nope; - else if ((rx->reganch & ROPT_CHECK_ALL) && !sawampersand) + else if ((prx->reganch & ROPT_CHECK_ALL) && !sawampersand) goto yup; - if (s && rx->check_offset_max < t - s) { - ++BmUSEFUL(rx->check_substr); - s -= rx->check_offset_max; + if (s && prx->check_offset_max < t - s) { + ++BmUSEFUL(prx->check_substr); + s -= prx->check_offset_max; } else s = t; @@ -862,20 +862,20 @@ play_it_again: beginning of match, and the match is anchored at s. */ else if (!multiline) { /* Anchored near beginning of string. */ I32 slen; - if (*SvPVX(rx->check_substr) != s[rx->check_offset_min] - || ((slen = SvCUR(rx->check_substr)) > 1 - && memNE(SvPVX(rx->check_substr), - s + rx->check_offset_min, slen))) + if (*SvPVX(prx->check_substr) != s[prx->check_offset_min] + || ((slen = SvCUR(prx->check_substr)) > 1 + && memNE(SvPVX(prx->check_substr), + s + prx->check_offset_min, slen))) goto nope; } - if (!rx->naughty && --BmUSEFUL(rx->check_substr) < 0 - && rx->check_substr == rx->float_substr) { - SvREFCNT_dec(rx->check_substr); - rx->check_substr = Nullsv; /* opt is being useless */ - rx->float_substr = Nullsv; + if (!prx->naughty && --BmUSEFUL(prx->check_substr) < 0 + && prx->check_substr == prx->float_substr) { + SvREFCNT_dec(prx->check_substr); + prx->check_substr = Nullsv; /* opt is being useless */ + prx->float_substr = Nullsv; } } - if (regexec_flags(rx, s, strend, truebase, minmatch, + if (regexec_flags(prx, s, strend, truebase, minmatch, screamer, NULL, safebase)) { curpm = pm; @@ -888,11 +888,11 @@ play_it_again: /*NOTREACHED*/ gotcha: - TAINT_IF(RX_MATCH_TAINTED(rx)); + TAINT_IF(RX_MATCH_TAINTED(prx)); if (gimme == G_ARRAY) { I32 iters, i, len; - iters = rx->nparens; + iters = prx->nparens; if (global && !iters) i = 1; else @@ -903,16 +903,16 @@ play_it_again: for (i = !i; i <= iters; i++) { PUSHs(sv_newmortal()); /*SUPPRESS 560*/ - if ((s = rx->startp[i]) && rx->endp[i] ) { - len = rx->endp[i] - s; + if ((s = prx->startp[i]) && prx->endp[i] ) { + len = prx->endp[i] - s; sv_setpvn(*SP, s, len); } } if (global) { - truebase = rx->subbeg; - strend = rx->subend; - if (rx->startp[0] && rx->startp[0] == rx->endp[0]) - ++rx->endp[0]; + truebase = prx->subbeg; + strend = prx->subend; + if (prx->startp[0] && prx->startp[0] == prx->endp[0]) + ++prx->endp[0]; PUTBACK; /* EVAL blocks may use stack */ goto play_it_again; } @@ -928,9 +928,9 @@ play_it_again: sv_magic(TARG, (SV*)0, 'g', Nullch, 0); mg = mg_find(TARG, 'g'); } - if (rx->startp[0]) { - mg->mg_len = rx->endp[0] - rx->subbeg; - if (rx->startp[0] == rx->endp[0]) + if (prx->startp[0]) { + mg->mg_len = prx->endp[0] - prx->subbeg; + if (prx->startp[0] == prx->endp[0]) mg->mg_flags |= MGf_MINMATCH; else mg->mg_flags &= ~MGf_MINMATCH; @@ -941,35 +941,35 @@ play_it_again: } yup: /* Confirmed by check_substr */ - TAINT_IF(RX_MATCH_TAINTED(rx)); - ++BmUSEFUL(rx->check_substr); + TAINT_IF(RX_MATCH_TAINTED(prx)); + ++BmUSEFUL(prx->check_substr); curpm = pm; if (pm->op_pmflags & PMf_ONCE) pm->op_pmflags |= PMf_USED; - Safefree(rx->subbase); - rx->subbase = Nullch; + Safefree(prx->subbase); + prx->subbase = Nullch; if (global) { - rx->subbeg = truebase; - rx->subend = strend; - rx->startp[0] = s; - rx->endp[0] = s + SvCUR(rx->check_substr); + prx->subbeg = truebase; + prx->subend = strend; + prx->startp[0] = s; + prx->endp[0] = s + SvCUR(prx->check_substr); goto gotcha; } if (sawampersand) { char *tmps; - tmps = rx->subbase = savepvn(t, strend-t); - rx->subbeg = tmps; - rx->subend = tmps + (strend-t); - tmps = rx->startp[0] = tmps + (s - t); - rx->endp[0] = tmps + SvCUR(rx->check_substr); + tmps = prx->subbase = savepvn(t, strend-t); + prx->subbeg = tmps; + prx->subend = tmps + (strend-t); + tmps = prx->startp[0] = tmps + (s - t); + prx->endp[0] = tmps + SvCUR(prx->check_substr); } LEAVE_SCOPE(oldsave); RETPUSHYES; nope: - if (rx->check_substr) - ++BmUSEFUL(rx->check_substr); + if (prx->check_substr) + ++BmUSEFUL(prx->check_substr); ret_no: if (global && !(pm->op_pmflags & PMf_CONTINUE)) { @@ -1442,7 +1442,7 @@ PP(pp_subst) bool rxtainted; char *orig; I32 safebase; - register REGEXP *rx = pm->op_pmregexp; + register REGEXP *prx = pm->op_pmregexp; STRLEN len; int force_on_match = 0; I32 oldsave = savestack_ix; @@ -1475,37 +1475,37 @@ PP(pp_subst) strend = s + len; maxiters = (strend - s) + 10; - if (!rx->prelen && curpm) { + if (!prx->prelen && curpm) { pm = curpm; - rx = pm->op_pmregexp; + prx = pm->op_pmregexp; } - screamer = ( (SvSCREAM(TARG) && rx->check_substr - && SvTYPE(rx->check_substr) == SVt_PVBM - && SvVALID(rx->check_substr)) + screamer = ( (SvSCREAM(TARG) && prx->check_substr + && SvTYPE(prx->check_substr) == SVt_PVBM + && SvVALID(prx->check_substr)) ? TARG : Nullsv); - safebase = (!rx->nparens && !sawampersand) ? 0 : REXEC_COPY_STR; + safebase = (!prx->nparens && !sawampersand) ? 0 : REXEC_COPY_STR; if (pm->op_pmflags & (PMf_MULTILINE|PMf_SINGLELINE)) { SAVEINT(multiline); multiline = pm->op_pmflags & PMf_MULTILINE; } orig = m = s; - if (rx->check_substr) { - if (!(rx->reganch & ROPT_NOSCAN)) { /* It floats. */ + if (prx->check_substr) { + if (!(prx->reganch & ROPT_NOSCAN)) { /* It floats. */ if (screamer) { I32 p = -1; - if (screamfirst[BmRARE(rx->check_substr)] < 0) + if (screamfirst[BmRARE(prx->check_substr)] < 0) goto nope; - else if (!(s = screaminstr(TARG, rx->check_substr, rx->check_offset_min, 0, &p, 0))) + else if (!(s = screaminstr(TARG, prx->check_substr, prx->check_offset_min, 0, &p, 0))) goto nope; } - else if (!(s = fbm_instr((unsigned char*)s + rx->check_offset_min, + else if (!(s = fbm_instr((unsigned char*)s + prx->check_offset_min, (unsigned char*)strend, - rx->check_substr))) + prx->check_substr))) goto nope; - if (s && rx->check_offset_max < s - m) { - ++BmUSEFUL(rx->check_substr); - s -= rx->check_offset_max; + if (s && prx->check_offset_max < s - m) { + ++BmUSEFUL(prx->check_substr); + s -= prx->check_offset_max; } else s = m; @@ -1514,17 +1514,17 @@ PP(pp_subst) beginning of match, and the match is anchored at s. */ else if (!multiline) { /* Anchored at beginning of string. */ I32 slen; - if (*SvPVX(rx->check_substr) != s[rx->check_offset_min] - || ((slen = SvCUR(rx->check_substr)) > 1 - && memNE(SvPVX(rx->check_substr), - s + rx->check_offset_min, slen))) + if (*SvPVX(prx->check_substr) != s[prx->check_offset_min] + || ((slen = SvCUR(prx->check_substr)) > 1 + && memNE(SvPVX(prx->check_substr), + s + prx->check_offset_min, slen))) goto nope; } - if (!rx->naughty && --BmUSEFUL(rx->check_substr) < 0 - && rx->check_substr == rx->float_substr) { - SvREFCNT_dec(rx->check_substr); - rx->check_substr = Nullsv; /* opt is being useless */ - rx->float_substr = Nullsv; + if (!prx->naughty && --BmUSEFUL(prx->check_substr) < 0 + && prx->check_substr == prx->float_substr) { + SvREFCNT_dec(prx->check_substr); + prx->check_substr = Nullsv; /* opt is being useless */ + prx->float_substr = Nullsv; } } @@ -1535,9 +1535,9 @@ PP(pp_subst) c = dstr ? SvPV(dstr, clen) : Nullch; /* can do inplace substitution? */ - if (c && clen <= rx->minlen && (once || !(safebase & REXEC_COPY_STR)) - && !(rx->reganch & ROPT_LOOKBEHIND_SEEN)) { - if (!regexec_flags(rx, s, strend, orig, 0, screamer, NULL, safebase)) { + if (c && clen <= prx->minlen && (once || !(safebase & REXEC_COPY_STR)) + && !(prx->reganch & ROPT_LOOKBEHIND_SEEN)) { + if (!regexec_flags(prx, s, strend, orig, 0, screamer, NULL, safebase)) { SPAGAIN; PUSHs(&sv_no); LEAVE_SCOPE(oldsave); @@ -1552,13 +1552,13 @@ PP(pp_subst) curpm = pm; SvSCREAM_off(TARG); /* disable possible screamer */ if (once) { - rxtainted = RX_MATCH_TAINTED(rx); - if (rx->subbase) { - m = orig + (rx->startp[0] - rx->subbase); - d = orig + (rx->endp[0] - rx->subbase); + rxtainted = RX_MATCH_TAINTED(prx); + if (prx->subbase) { + m = orig + (prx->startp[0] - prx->subbase); + d = orig + (prx->endp[0] - prx->subbase); } else { - m = rx->startp[0]; - d = rx->endp[0]; + m = prx->startp[0]; + d = prx->endp[0]; } s = orig; if (m - s > strend - d) { /* faster to shorten from end */ @@ -1602,8 +1602,8 @@ PP(pp_subst) do { if (iters++ > maxiters) DIE("Substitution loop"); - rxtainted |= RX_MATCH_TAINTED(rx); - m = rx->startp[0]; + rxtainted |= RX_MATCH_TAINTED(prx); + m = prx->startp[0]; /*SUPPRESS 560*/ if (i = m - s) { if (s != d) @@ -1614,8 +1614,8 @@ PP(pp_subst) Copy(c, d, clen, char); d += clen; } - s = rx->endp[0]; - } while (regexec_flags(rx, s, strend, orig, s == m, + s = prx->endp[0]; + } while (regexec_flags(prx, s, strend, orig, s == m, Nullsv, NULL, 0)); /* don't match same null twice */ if (s != d) { i = strend - s; @@ -1637,13 +1637,13 @@ PP(pp_subst) RETURN; } - if (regexec_flags(rx, s, strend, orig, 0, screamer, NULL, safebase)) { + if (regexec_flags(prx, s, strend, orig, 0, screamer, NULL, safebase)) { if (force_on_match) { force_on_match = 0; s = SvPV_force(TARG, len); goto force_it; } - rxtainted = RX_MATCH_TAINTED(rx); + rxtainted = RX_MATCH_TAINTED(prx); dstr = NEWSV(25, len); sv_setpvn(dstr, m, s-m); curpm = pm; @@ -1656,22 +1656,22 @@ PP(pp_subst) do { if (iters++ > maxiters) DIE("Substitution loop"); - rxtainted |= RX_MATCH_TAINTED(rx); - if (rx->subbase && rx->subbase != orig) { + rxtainted |= RX_MATCH_TAINTED(prx); + if (prx->subbase && prx->subbase != orig) { m = s; s = orig; - orig = rx->subbase; + orig = prx->subbase; s = orig + (m - s); strend = s + (strend - m); } - m = rx->startp[0]; + m = prx->startp[0]; sv_catpvn(dstr, s, m-s); - s = rx->endp[0]; + s = prx->endp[0]; if (clen) sv_catpvn(dstr, c, clen); if (once) break; - } while (regexec_flags(rx, s, strend, orig, s == m, Nullsv, NULL, safebase)); + } while (regexec_flags(prx, s, strend, orig, s == m, Nullsv, NULL, safebase)); sv_catpvn(dstr, s, strend - s); TAINT_IF(rxtainted); @@ -1695,7 +1695,7 @@ PP(pp_subst) goto ret_no; nope: - ++BmUSEFUL(rx->check_substr); + ++BmUSEFUL(prx->check_substr); ret_no: SPAGAIN; diff --git a/pp_sys.c b/pp_sys.c index 19650b9..8159a5c 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -497,7 +497,7 @@ PP(pp_binmode) * document this anywhere). GSAR 97-5-24 */ PerlIO_seek(fp,0L,0); - fp->flags |= _F_BIN; + ((FILE*)fp)->flags |= _F_BIN; #endif RETPUSHYES; } diff --git a/proto.h b/proto.h index 2384f7f..440ea65 100644 --- a/proto.h +++ b/proto.h @@ -88,14 +88,14 @@ VIRTUAL I32 filter_read _((int idx, SV* buffer, int maxlen)); VIRTUAL char ** get_op_descs _((void)); VIRTUAL char ** get_op_names _((void)); VIRTUAL I32 cxinc _((void)); -void deb _((const char* pat,...)) __attribute__((format(printf,1,2))); -void deb_growlevel _((void)); -I32 debstackptrs _((void)); #ifdef DEBUGGING -void debprofdump _((void)); -I32 debop _((OP* o)); +VIRTUAL void deb _((const char* pat,...)) __attribute__((format(printf,1,2))); +VIRTUAL void deb_growlevel _((void)); +VIRTUAL void debprofdump _((void)); +VIRTUAL I32 debop _((OP* o)); +VIRTUAL I32 debstack _((void)); +VIRTUAL I32 debstackptrs _((void)); #endif -I32 debstack _((void)); VIRTUAL char* delimcpy _((char* to, char* toend, char* from, char* fromend, int delim, I32* retlen)); VIRTUAL void deprecate _((char* s)); diff --git a/scope.h b/scope.h index 0f57874..cc349f0 100644 --- a/scope.h +++ b/scope.h @@ -80,11 +80,13 @@ #ifdef PERL_OBJECT #define CALLDESTRUCTOR this->*SSPOPDPTR #define SAVEDESTRUCTOR(f,p) \ - save_destructor((DESTRUCTORFUNC)(f),SOFT_CAST(void*)(p)) + save_destructor((DESTRUCTORFUNC)(FUNC_NAME_TO_PTR(f)), \ + SOFT_CAST(void*)(p)) #else #define CALLDESTRUCTOR *SSPOPDPTR #define SAVEDESTRUCTOR(f,p) \ - save_destructor(SOFT_CAST(void(*)_((void*)))(f),SOFT_CAST(void*)(p)) + save_destructor(SOFT_CAST(void(*)_((void*)))(FUNC_NAME_TO_PTR(f)), \ + SOFT_CAST(void*)(p)) #endif #define SAVESTACK_POS() STMT_START { \ SSCHECK(2); \ diff --git a/sv.c b/sv.c index cebe4bd..0fa6e15 100644 --- a/sv.c +++ b/sv.c @@ -323,7 +323,7 @@ do_report_used(SV *sv) void sv_report_used(void) { - visit(do_report_used); + visit(FUNC_NAME_TO_PTR(do_report_used)); } STATIC void @@ -355,9 +355,9 @@ sv_clean_objs(void) { in_clean_objs = TRUE; #ifndef DISABLE_DESTRUCTOR_KLUDGE - visit(do_clean_named_objs); + visit(FUNC_NAME_TO_PTR(do_clean_named_objs)); #endif - visit(do_clean_objs); + visit(FUNC_NAME_TO_PTR(do_clean_objs)); in_clean_objs = FALSE; } @@ -373,7 +373,7 @@ void sv_clean_all(void) { in_clean_all = TRUE; - visit(do_clean_all); + visit(FUNC_NAME_TO_PTR(do_clean_all)); in_clean_all = FALSE; } diff --git a/toke.c b/toke.c index 00dbf7f..c24f878 100644 --- a/toke.c +++ b/toke.c @@ -876,23 +876,23 @@ scan_const(char *start) *d++ = *s++; } else if (s[2] == '{') { /* This should march regcomp.c */ I32 count = 1; - char *regparse = s + 3; + char *pregparse = s + 3; char c; - while (count && (c = *regparse)) { - if (c == '\\' && regparse[1]) - regparse++; + while (count && (c = *pregparse)) { + if (c == '\\' && pregparse[1]) + pregparse++; else if (c == '{') count++; else if (c == '}') count--; - regparse++; + pregparse++; } - if (*regparse == ')') - regparse++; + if (*pregparse == ')') + pregparse++; else yyerror("Sequence (?{...}) not terminated or not {}-balanced"); - while (s < regparse && *s != ')') + while (s < pregparse && *s != ')') *d++ = *s++; } } diff --git a/win32/Makefile b/win32/Makefile index 846f9a8..230ccb1 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -10,34 +10,34 @@ # # Set these to wherever you want "nmake install" to put your # newly built perl. -INST_DRV=c: -INST_TOP=$(INST_DRV)\perl5004.5x +INST_DRV = c: +INST_TOP = $(INST_DRV)\perl5004.5x # # uncomment to enable threads-capabilities -#USE_THREADS=define +#USE_THREADS = define # # uncomment next line if you are using Visual C++ 2.x -#CCTYPE=MSVC20 +#CCTYPE = MSVC20 # # uncomment next line if you want to use the perl object -OBJECT=-DPERL_OBJECT +OBJECT = -DPERL_OBJECT # # uncomment next line if you want debug version of perl (big,slow) -#CFG=Debug +#CFG = Debug # # if you have the source for des_fcrypt(), uncomment this and make sure the # file exists (see README.win32) -#CRYPT_SRC=des_fcrypt.c +#CRYPT_SRC = des_fcrypt.c # # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a # library, uncomment this, and make sure the library exists (see README.win32) -#CRYPT_LIB=des_fcrypt.lib +#CRYPT_LIB = des_fcrypt.lib # # set this if you wish to use perl's malloc @@ -48,37 +48,41 @@ OBJECT=-DPERL_OBJECT # # set the install locations of the compiler include/libraries -#CCHOME = f:\msvc20 -CCHOME = $(MSVCDIR) -CCINCDIR = $(CCHOME)\include -CCLIBDIR = $(CCHOME)\lib +#CCHOME = f:\msvc20 +CCHOME = $(MSVCDIR) +CCINCDIR = $(CCHOME)\include +CCLIBDIR = $(CCHOME)\lib # # set this to your email address (perl will guess a value from # from your loginname and your hostname, which may not be right) -#EMAIL = +#EMAIL = ##################### CHANGE THESE ONLY IF YOU MUST ##################### !IF "$(CRYPT_SRC)$(CRYPT_LIB)" == "" -D_CRYPT=undef +D_CRYPT = undef !ELSE -D_CRYPT=define -CRYPT_FLAG=-DHAVE_DES_FCRYPT +D_CRYPT = define +CRYPT_FLAG = -DHAVE_DES_FCRYPT !ENDIF -!IF "$(OBJECT)" != "" || "$(PERL_MALLOC)" == "" +!IF "$(OBJECT)" != "" PERL_MALLOC = undef !ENDIF -#BUILDOPT = -DMULTIPLICITY -#BUILDOPT = -DPERL_GLOBAL_STRUCT -DMULTIPLICITY -# -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include +!IF "$(PERL_MALLOC)" == "" +PERL_MALLOC = undef +!ENDIF !IF "$(USE_THREADS)" == "" -USE_THREADS = undef +USE_THREADS = undef !ENDIF +#BUILDOPT = -DMULTIPLICITY +#BUILDOPT = -DPERL_GLOBAL_STRUCT -DMULTIPLICITY +# -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include + !IF "$(PROCESSOR_ARCHITECTURE)" == "" PROCESSOR_ARCHITECTURE = x86 !ENDIF @@ -91,72 +95,80 @@ ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE) ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE +AUTODIR = ..\lib\auto # # Programs to compile, build .lib files and link # -CC=cl.exe -LINK32=link.exe -LIB32=$(LINK32) -lib +CC = cl.exe +LINK32 = link.exe +LIB32 = $(LINK32) -lib + # # Options # -!IF "$(RUNTIME)" == "" -! IF "$(OBJECT)" == "-DPERL_OBJECT" -RUNTIME = -MT -! ELSE -RUNTIME = -MD -! ENDIF +!IF "$(OBJECT)" == "-DPERL_OBJECT" +RUNTIME = -MT +# XXX building with -MD fails many tests, but cannot investigate +# because building with debug crashes compiler :-( GSAR )-: +#RUNTIME = -MD +!ELSE +RUNTIME = -MD !ENDIF -INCLUDES = -I..\lib\CORE -#PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX -DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG) -LOCDEFS = -DPERLDLL -DPERL_CORE -SUBSYS = console + +INCLUDES = -I.\include -I. -I.. +#PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX +DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG) +LOCDEFS = -DPERLDLL -DPERL_CORE +SUBSYS = console +CXX_FLAG = -TP -GX !IF "$(RUNTIME)" == "-MD" -LIBC = msvcrt.lib -WINIOMAYBE = +LIBC = msvcrt.lib !ELSE -LIBC = -WINIOMAYBE = +LIBC = libcmt.lib !ENDIF !IF "$(CFG)" == "Debug" ! IF "$(CCTYPE)" == "MSVC20" -OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING +OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING ! ELSE -OPTIMIZE = -Od -TP $(RUNTIME)d -Z7 -D_DEBUG -DDEBUGGING +OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG -DDEBUGGING ! ENDIF -LINK_DBG = -debug -pdb:none +LINK_DBG = -debug -pdb:none !ELSE ! IF "$(CCTYPE)" == "MSVC20" -OPTIMIZE = -O1 $(RUNTIME) -DNDEBUG +OPTIMIZE = -Od $(RUNTIME) -DNDEBUG ! ELSE -OPTIMIZE = -O1 -TP $(RUNTIME) -DNDEBUG +OPTIMIZE = -Od $(RUNTIME) -DNDEBUG ! ENDIF -LINK_DBG = -release +LINK_DBG = -release !ENDIF -# we don't add LIBC here, the compiler does it based on -MD/-MT -LIBFILES = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \ - winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \ - oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \ - version.lib odbc32.lib odbccp32.lib +!IF "$(OBJECT)" != "" +OPTIMIZE = $(OPTIMIZE) $(CXX_FLAG) +!ENDIF -CFLAGS = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(OBJECT) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) +# we don't add LIBC here, the compiler does it based on -MD/-MT +LIBFILES = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \ + oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \ + version.lib odbc32.lib odbccp32.lib -CFLAGSMINI = -nologo -Gf -W3 -I.\include -I. -I.. $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) +CFLAGS = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \ + $(PCHFLAGS) $(OPTIMIZE) +LINK_FLAGS = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE) +OBJOUT_FLAG = -Fo +EXEOUT_FLAG = -Fe -LINK_FLAGS = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE) -OBJOUT_FLAG = -Fo -EXEOUT_FLAG = -Fe +CFLAGS_O = $(CFLAGS) $(OBJECT) #################### do not edit below this line ####################### ############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ############## o = .obj + # # Rules # @@ -164,306 +176,273 @@ o = .obj .SUFFIXES : .c $(o) .dll .lib .exe .c$(o): - $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $< + $(CC) -c $(CFLAGS_O) $(OBJOUT_FLAG)$@ $< + +.y.c: + $(NOOP) $(o).dll: $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \ -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL) -.y.c: - $(NOOP) - # -INST_BIN=$(INST_TOP)\bin -INST_LIB=$(INST_TOP)\lib -INST_POD=$(INST_LIB)\pod -INST_HTML=$(INST_POD)\html -LIBDIR=..\lib -EXTDIR=..\ext -PODDIR=..\pod -EXTUTILSDIR=$(LIBDIR)\extutils +INST_BIN = $(INST_TOP)\bin +INST_LIB = $(INST_TOP)\lib +INST_POD = $(INST_LIB)\pod +INST_HTML = $(INST_POD)\html +LIBDIR = ..\lib +EXTDIR = ..\ext +PODDIR = ..\pod +EXTUTILSDIR = $(LIBDIR)\extutils # # various targets -!IF "$(OBJECT)" == "-DPERL_OBJECT" -PERLIMPLIB=..\perlcore.lib -PERLDLL=..\perlcore.dll +!IF "$(OBJECT)" == "-DPERL_OBJECT" +PERLIMPLIB = ..\perlcore.lib +PERLDLL = ..\perlcore.dll !ELSE -PERLIMPLIB=..\perl.lib -PERLDLL=..\perl.dll +PERLIMPLIB = ..\perl.lib +PERLDLL = ..\perl.dll !ENDIF -MINIPERL=..\miniperl.exe -MINIDIR=.\mini -PERLEXE=..\perl.exe -GLOBEXE=..\perlglob.exe -CONFIGPM=..\lib\Config.pm -MINIMOD=..\lib\ExtUtils\Miniperl.pm -X2P=..\x2p\a2p.exe - -PL2BAT=bin\pl2bat.pl -GLOBBAT = bin\perlglob.bat - -MAKE=nmake -nologo -CFGSH_TMPL = config.vc -CFGH_TMPL = config_H.vc -PERL95EXE=..\perl95.exe -XCOPY=xcopy /f /r /i /d -RCOPY=xcopy /f /r /i /e /d -NOOP=@echo -NULL= - -EXTRA_SRC = $(EXTRA_SRC) $(CRYPT_SRC) + +MINIPERL = ..\miniperl.exe +MINIDIR = .\mini +PERLEXE = ..\perl.exe +GLOBEXE = ..\perlglob.exe +CONFIGPM = ..\lib\Config.pm +MINIMOD = ..\lib\ExtUtils\Miniperl.pm +X2P = ..\x2p\a2p.exe + +PL2BAT = bin\pl2bat.pl +GLOBBAT = bin\perlglob.bat + +MAKE = nmake -nologo + +CFGSH_TMPL = config.vc +CFGH_TMPL = config_H.vc +PERL95EXE = ..\perl95.exe + +XCOPY = xcopy /f /r /i /d +RCOPY = xcopy /f /r /i /e /d +NOOP = @echo +NULL = + +# +# filenames given to xsubpp must have forward slashes (since it puts +# full pathnames in #line strings) +XSUBPP = ..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp \ + -C++ -prototypes + +CORE_SRC = \ + ..\av.c \ + ..\byterun.c \ + ..\deb.c \ + ..\doio.c \ + ..\doop.c \ + ..\dump.c \ + ..\globals.c \ + ..\gv.c \ + ..\hv.c \ + ..\mg.c \ + ..\op.c \ + ..\perl.c \ + ..\perly.c \ + ..\pp.c \ + ..\pp_ctl.c \ + ..\pp_hot.c \ + ..\pp_sys.c \ + ..\regcomp.c \ + ..\regexec.c \ + ..\run.c \ + ..\scope.c \ + ..\sv.c \ + ..\taint.c \ + ..\toke.c \ + ..\universal.c \ + ..\util.c + +CORE_SRC = $(CORE_SRC) $(CRYPT_SRC) !IF "$(PERL_MALLOC)" == "define" -EXTRA_SRC = $(EXTRA_SRC) ..\malloc.c +CORE_SRC = $(CORE_SRC) ..\malloc.c !ENDIF !IF "$(OBJECT)" == "" -EXTRA_SRC = $(EXTRA_SRC) ..\perlio.c +CORE_SRC = $(CORE_SRC) ..\perlio.c !ENDIF -EXTRA_OBJ = $(EXTRA_SRC:.c=.obj) +WIN32_SRC = \ + .\win32.c \ + .\win32sck.c -# -# filenames given to xsubpp must have forward slashes (since it puts -# full pathnames in #line strings) -XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes - -CORE_C= ..\av.c \ - ..\byterun.c \ - ..\deb.c \ - ..\doio.c \ - ..\doop.c \ - ..\dump.c \ - ..\globals.c \ - ..\gv.c \ - ..\hv.c \ - ..\mg.c \ - ..\op.c \ - ..\perl.c \ - ..\perly.c \ - ..\pp.c \ - ..\pp_ctl.c \ - ..\pp_hot.c \ - ..\pp_sys.c \ - ..\regcomp.c \ - ..\regexec.c \ - ..\run.c \ - ..\scope.c \ - ..\sv.c \ - ..\taint.c \ - ..\toke.c \ - ..\universal.c \ - ..\util.c \ - $(EXTRA_SRC) - - -CORE_OBJ= ..\av$(o) \ - ..\byterun$(o) \ - ..\deb$(o) \ - ..\doio$(o) \ - ..\doop$(o) \ - ..\dump$(o) \ - ..\globals$(o) \ - ..\gv$(o) \ - ..\hv$(o) \ - ..\mg$(o) \ - ..\op$(o) \ - ..\perl$(o) \ - ..\perly$(o) \ - ..\pp$(o) \ - ..\pp_ctl$(o) \ - ..\pp_hot$(o) \ - ..\pp_sys$(o) \ - ..\regcomp$(o) \ - ..\regexec$(o) \ - ..\run$(o) \ - ..\scope$(o) \ - ..\sv$(o) \ - ..\taint$(o) \ - ..\toke$(o) \ - ..\universal$(o)\ - ..\util$(o) \ - $(EXTRA_OBJ) - -MINI_OBJ= $(MINIDIR)\av$(o) \ - $(MINIDIR)\byterun$(o) \ - $(MINIDIR)\miniperlmain$(o) \ - $(MINIDIR)\deb$(o) \ - $(MINIDIR)\doio$(o) \ - $(MINIDIR)\doop$(o) \ - $(MINIDIR)\dump$(o) \ - $(MINIDIR)\globals$(o) \ - $(MINIDIR)\gv$(o) \ - $(MINIDIR)\hv$(o) \ - $(MINIDIR)\mg$(o) \ - $(MINIDIR)\op$(o) \ - $(MINIDIR)\perl$(o) \ - $(MINIDIR)\perly$(o) \ - $(MINIDIR)\pp$(o) \ - $(MINIDIR)\pp_ctl$(o) \ - $(MINIDIR)\pp_hot$(o) \ - $(MINIDIR)\pp_sys$(o) \ - $(MINIDIR)\regcomp$(o) \ - $(MINIDIR)\regexec$(o) \ - $(MINIDIR)\run$(o) \ - $(MINIDIR)\scope$(o) \ - $(MINIDIR)\sv$(o) \ - $(MINIDIR)\taint$(o) \ - $(MINIDIR)\toke$(o) \ - $(MINIDIR)\universal$(o)\ - $(MINIDIR)\util$(o) \ - $(MINIDIR)\malloc$(o) \ - $(MINIDIR)\perlio$(o) \ - -MINIWIN=$(MINIDIR)\win32$(o) \ - $(MINIDIR)\win32sck$(o) \ - $(MINIDIR)\win32thread$(o) - -WIN32_C = perllib.c \ - win32.c \ - win32sck.c \ - win32thread.c - -!IF "$(USE_THREADS)" == "undef" && "$(OBJECT)" == "-DPERL_OBJECT" -WIN32_OBJ = win32$(o) \ - win32sck$(o) \ -!ELSE -WIN32_OBJ = win32$(o) \ - win32sck$(o) \ - win32thread$(o) +!IF "$(USE_THREADS)" == "define" || "$(OBJECT)" == "" +WIN32_SRC = $(WIN32_SRC) .\win32thread.c !ENDIF -PERL95_OBJ = perl95$(o) \ - win32mt$(o) \ - win32sckmt$(o) +PERL95_SRC = \ + perl95.c \ + win32mt.c \ + win32sckmt.c +DLL_SRC = $(DYNALOADER).c -!IF "$(OBJECT)" == "-DPERL_OBJECT" -DLL_OBJ = $(DYNALOADER)$(o) + +!IF "$(OBJECT)" == "" +DLL_SRC = $(DLL_SRC) perllib.c +!ENDIF + +X2P_SRC = \ + ..\x2p\a2p.c \ + ..\x2p\hash.c \ + ..\x2p\str.c \ + ..\x2p\util.c \ + ..\x2p\walk.c + +CORE_H = \ + ..\av.h \ + ..\byterun.h \ + ..\bytecode.h \ + ..\cop.h \ + ..\cv.h \ + ..\dosish.h \ + ..\embed.h \ + ..\form.h \ + ..\gv.h \ + ..\handy.h \ + ..\hv.h \ + ..\mg.h \ + ..\nostdio.h \ + ..\op.h \ + ..\opcode.h \ + ..\perl.h \ + ..\perlio.h \ + ..\perlsdio.h \ + ..\perlsfio.h \ + ..\perly.h \ + ..\pp.h \ + ..\proto.h \ + ..\regexp.h \ + ..\scope.h \ + ..\sv.h \ + ..\thread.h \ + ..\unixish.h \ + ..\util.h \ + ..\XSUB.h \ + .\config.h \ + ..\EXTERN.h \ + ..\perlvars.h \ + ..\intrpvar.h \ + ..\thrdvar.h \ + .\include\dirent.h \ + .\include\netdb.h \ + .\include\sys\socket.h \ + .\win32.h + +CORE_OBJ = $(CORE_SRC:.c=.obj) +WIN32_OBJ = $(WIN32_SRC:.c=.obj) +MINICORE_OBJ = $(CORE_OBJ:..\=.\mini\) \ + $(MINIDIR)\perlio$(o) \ + $(MINIDIR)\miniperlmain$(o) +MINIWIN32_OBJ = $(WIN32_OBJ:.\=.\mini\) +MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ) +PERL95_OBJ = $(PERL95_SRC:.c=.obj) DynaLoadmt$(o) +DLL_OBJ = $(DLL_SRC:.c=.obj) +X2P_OBJ = $(X2P_SRC:.c=.obj) + +PERLDLL_OBJ = $(CORE_OBJ) +PERLEXE_OBJ = perlmain$(o) + +!IF "$(OBJECT)" == "" +PERLDLL_OBJ = $(PERLDLL_OBJ) $(WIN32_OBJ) $(DLL_OBJ) !ELSE -DLL_OBJ = perllib$(o) $(DYNALOADER)$(o) +PERLEXE_OBJ = $(PERLEXE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) !ENDIF -X2P_OBJ = ..\x2p\a2p$(o) \ - ..\x2p\hash$(o) \ - ..\x2p\str$(o) \ - ..\x2p\util$(o) \ - ..\x2p\walk$(o) - -CORE_H = ..\av.h \ - ..\byterun.h \ - ..\bytecode.h \ - ..\cop.h \ - ..\cv.h \ - ..\dosish.h \ - ..\embed.h \ - ..\form.h \ - ..\gv.h \ - ..\handy.h \ - ..\hv.h \ - ..\mg.h \ - ..\nostdio.h \ - ..\op.h \ - ..\opcode.h \ - ..\perl.h \ - ..\perlio.h \ - ..\perlsdio.h \ - ..\perlsfio.h \ - ..\perly.h \ - ..\pp.h \ - ..\proto.h \ - ..\regexp.h \ - ..\scope.h \ - ..\sv.h \ - ..\thread.h \ - ..\unixish.h \ - ..\util.h \ - ..\XSUB.h \ - .\config.h \ - ..\EXTERN.h \ - ..\perlvars.h \ - ..\intrpvar.h \ - ..\thrdvar.h \ - .\include\dirent.h \ - .\include\netdb.h \ - .\include\sys\socket.h \ - .\win32.h - -DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File attrs Thread B -STATIC_EXT=DynaLoader - -DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader -SOCKET=$(EXTDIR)\Socket\Socket -FCNTL=$(EXTDIR)\Fcntl\Fcntl -OPCODE=$(EXTDIR)\Opcode\Opcode -SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File -IO=$(EXTDIR)\IO\IO -ATTRS=$(EXTDIR)\attrs\attrs -THREAD=$(EXTDIR)\Thread\Thread -B=$(EXTDIR)\B\B - -SOCKET_DLL=..\lib\auto\Socket\Socket.dll -FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll -OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll -SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll -IO_DLL=..\lib\auto\IO\IO.dll -ATTRS_DLL=..\lib\auto\attrs\attrs.dll -THREAD_DLL=..\lib\auto\Thread\Thread.dll -B_DLL=..\lib\auto\B\B.dll - -STATICLINKMODULES=DynaLoader -DYNALOADMODULES= \ - $(SOCKET_DLL) \ - $(FCNTL_DLL) \ - $(OPCODE_DLL) \ - $(SDBM_FILE_DLL)\ - $(IO_DLL) \ - $(ATTRS_DLL) -# $(THREAD_DLL) \ -# $(B_DLL) - -POD2HTML=$(PODDIR)\pod2html -POD2MAN=$(PODDIR)\pod2man -POD2LATEX=$(PODDIR)\pod2latex -POD2TEXT=$(PODDIR)\pod2text - -CFG_VARS= "INST_DRV=$(INST_DRV)" \ - "INST_TOP=$(INST_TOP)" \ - "archname=$(ARCHNAME)" \ - "cc=$(CC)" \ - "ccflags=$(OPTIMIZE) $(DEFINES) $(OBJECT)"\ - "cf_email=$(EMAIL)" \ - "d_crypt=$(D_CRYPT)" \ - "d_mymalloc=$(PERL_MALLOC)" \ - "libs=$(LIBFILES)" \ - "incpath=$(CCINCDIR)" \ - "libperl=$(PERLIMPLIB)" \ - "libpth=$(CCLIBDIR)" \ - "libc=$(LIBC)" \ - "static_ext=$(STATIC_EXT)" \ - "dynamic_ext=$(DYNAMIC_EXT)" \ - "usethreads=$(USE_THREADS)" \ - "LINK_FLAGS=$(LINK_FLAGS)" \ - "optimize=$(OPTIMIZE)" +DYNAMIC_EXT = Socket IO Fcntl Opcode SDBM_File attrs Thread B +STATIC_EXT = DynaLoader + +DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader +SOCKET = $(EXTDIR)\Socket\Socket +FCNTL = $(EXTDIR)\Fcntl\Fcntl +OPCODE = $(EXTDIR)\Opcode\Opcode +SDBM_FILE = $(EXTDIR)\SDBM_File\SDBM_File +IO = $(EXTDIR)\IO\IO +ATTRS = $(EXTDIR)\attrs\attrs +THREAD = $(EXTDIR)\Thread\Thread +B = $(EXTDIR)\B\B + +SOCKET_DLL = $(AUTODIR)\Socket\Socket.dll +FCNTL_DLL = $(AUTODIR)\Fcntl\Fcntl.dll +OPCODE_DLL = $(AUTODIR)\Opcode\Opcode.dll +SDBM_FILE_DLL = $(AUTODIR)\SDBM_File\SDBM_File.dll +IO_DLL = $(AUTODIR)\IO\IO.dll +ATTRS_DLL = $(AUTODIR)\attrs\attrs.dll +THREAD_DLL = $(AUTODIR)\Thread\Thread.dll +B_DLL = $(AUTODIR)\B\B.dll + +EXTENSION_C = \ + $(SOCKET).c \ + $(FCNTL).c \ + $(OPCODE).c \ + $(SDBM_FILE).c \ + $(IO).c \ + $(ATTRS).c \ + $(THREAD).c \ + $(B).c + +EXTENSION_DLL = \ + $(SOCKET_DLL) \ + $(FCNTL_DLL) \ + $(OPCODE_DLL) \ + $(SDBM_FILE_DLL)\ + $(IO_DLL) \ + $(ATTRS_DLL) +# $(THREAD_DLL) \ +# $(B_DLL) + +POD2HTML = $(PODDIR)\pod2html +POD2MAN = $(PODDIR)\pod2man +POD2LATEX = $(PODDIR)\pod2latex +POD2TEXT = $(PODDIR)\pod2text + +CFG_VARS = \ + "INST_DRV=$(INST_DRV)" \ + "INST_TOP=$(INST_TOP)" \ + "archname=$(ARCHNAME)" \ + "cc=$(CC)" \ + "ccflags=$(OPTIMIZE) $(DEFINES) $(OBJECT)" \ + "cf_email=$(EMAIL)" \ + "d_crypt=$(D_CRYPT)" \ + "d_mymalloc=$(PERL_MALLOC)" \ + "libs=$(LIBFILES)" \ + "incpath=$(CCINCDIR)" \ + "libperl=$(PERLIMPLIB)" \ + "libpth=$(CCLIBDIR)" \ + "libc=$(LIBC)" \ + "make=nmake" \ + "static_ext=$(STATIC_EXT)" \ + "dynamic_ext=$(DYNAMIC_EXT)" \ + "usethreads=$(USE_THREADS)" \ + "LINK_FLAGS=$(LINK_FLAGS)" \ + "optimize=$(OPTIMIZE)" # # Top targets # -all: $(GLOBEXE) $(X2P) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) $(DYNALOADMODULES) +all : $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) $(X2P) \ + $(EXTENSION_DLL) $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c #------------------------------------------------------------ -$(GLOBEXE): perlglob$(o) +$(GLOBEXE) : perlglob$(o) $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \ perlglob$(o) setargv$(o) perlglob$(o) : perlglob.c - config.w32 : $(CFGSH_TMPL) copy $(CFGSH_TMPL) config.w32 @@ -474,60 +453,58 @@ config.w32 : $(CFGSH_TMPL) ..\config.sh : config.w32 $(MINIPERL) config_sh.PL $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) config.w32 > ..\config.sh +# this target is for when changes to the main config.sh happen +# edit config.{b,v,g}c and make this target once for each supported +# compiler (e.g. `dmake CCTYPE=BORLAND regen_config_h`) +regen_config_h: + perl config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh + cd .. + -del /f perl.exe + perl configpm + cd win32 + -del /f $(CFGH_TMPL) + -mkdir ..\lib\CORE + -perl -I..\lib config_h.PL + rename config.h $(CFGH_TMPL) + $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl cd .. && miniperl configpm if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL) $(XCOPY) ..\*.h $(COREDIR)\*.* $(XCOPY) *.h $(COREDIR)\*.* $(RCOPY) include $(COREDIR)\*.* - $(MINIPERL) -I..\lib config_h.PL || $(MAKE) CCTYPE=$(CCTYPE) \ - RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM) + $(MINIPERL) -I..\lib config_h.PL || $(MAKE) $(MAKEFLAGS) $(CONFIGPM) -$(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(MINIWIN) +$(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(LINK32) -subsystem:console -out:$@ @<< - $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ) $(MINIWIN) + $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ) << -$(MINIDIR) : +$(MINIDIR) : if not exist "$(MINIDIR)" mkdir "$(MINIDIR)" -$(MINI_OBJ) : $(CORE_H) - $(CC) -c $(CFLAGSMINI) $(OBJOUT_FLAG)$@ ..\$(*F).c +$(MINICORE_OBJ) : $(CORE_H) + $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ ..\$(*F).c -$(MINIWIN) : $(CORE_H) - $(CC) -c $(CFLAGSMINI) $(OBJOUT_FLAG)$@ $(*F).c +$(MINIWIN32_OBJ) : $(CORE_H) + $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*F).c -$(WIN32_OBJ) : $(CORE_H) -$(CORE_OBJ) : $(CORE_H) -$(DLL_OBJ) : $(CORE_H) -$(PERL95_OBJ) : $(CORE_H) -$(X2P_OBJ) : $(CORE_H) +$(WIN32_OBJ) : $(CORE_H) +$(CORE_OBJ) : $(CORE_H) +$(MINI_OBJ) : $(CORE_H) +$(DLL_OBJ) : $(CORE_H) +$(PERL95_OBJ) : $(CORE_H) +$(X2P_OBJ) : $(CORE_H) - -!IF "$(OBJECT)" == "-DPERL_OBJECT" -perldll.def : $(CONFIGPM) - echo LIBRARY PerlCore >perldll.def - echo DESCRIPTION 'Perl interpreter' >>perldll.def - echo EXPORTS >>perldll.def - echo perl_alloc >>perldll.def - - -$(PERLDLL): perldll.def $(CORE_OBJ) - $(LINK32) -dll -def:perldll.def -out:$@ @<< - $(LINK_FLAGS) $(LIBFILES) $(CORE_OBJ) -<< - $(XCOPY) $(PERLIMPLIB) $(COREDIR) -!ELSE -perldll.def : $(CONFIGPM) ..\global.sym makedef.pl - $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) \ +perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym makedef.pl + $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) $(OBJECT) \ CCTYPE=$(CCTYPE) > perldll.def -$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) +$(PERLDLL): perldll.def $(PERLDLL_OBJ) $(LINK32) -dll -def:perldll.def -out:$@ @<< - $(LINK_FLAGS) $(LIBFILES) $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) + $(LINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ) << $(XCOPY) $(PERLIMPLIB) $(COREDIR) -!ENDIF perl.def : $(MINIPERL) makeperldef.pl $(MINIPERL) -I..\lib makeperldef.pl $(NULL) > perl.def @@ -536,79 +513,63 @@ $(MINIMOD) : $(MINIPERL) ..\minimod.pl cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm ..\x2p\a2p$(o) : ..\x2p\a2p.c - $(CC) $(CFLAGSMINI) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c ..\x2p\hash$(o) : ..\x2p\hash.c - $(CC) $(CFLAGSMINI) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c ..\x2p\str$(o) : ..\x2p\str.c - $(CC) $(CFLAGSMINI) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c ..\x2p\util$(o) : ..\x2p\util.c - $(CC) $(CFLAGSMINI) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c ..\x2p\walk$(o) : ..\x2p\walk.c - $(CC) $(CFLAGSMINI) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c -$(X2P) : $(X2P_OBJ) +$(X2P) : $(MINIPERL) $(X2P_OBJ) + $(MINIPERL) ..\x2p\find2perl.PL + $(MINIPERL) ..\x2p\s2p.PL $(LINK32) -subsystem:console -out:$@ @<< - $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ) + $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ) << perlmain.c : runperl.c copy runperl.c perlmain.c perlmain$(o) : perlmain.c - $(CC) $(CFLAGS) -UPERLDLL -c perlmain.c + $(CC) $(CFLAGS_O) -UPERLDLL $(EXEOUT_FLAG)$@ -c perlmain.c + +$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) + $(LINK32) -subsystem:console -out:$@ $(LINK_FLAGS) $(LIBFILES) \ + $(PERLEXE_OBJ) $(PERLIMPLIB) + copy splittree.pl .. + $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) perl95.c : runperl.c copy runperl.c perl95.c perl95$(o) : perl95.c - $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c perl95.c + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c perl95.c win32sckmt$(o) : win32sck.c - $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32sckmt$(o) win32sck.c + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \ + $(OBJOUT_FLAG)win32sckmt$(o) win32sck.c win32mt$(o) : win32.c - $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32mt$(o) win32.c - - -!IF "$(OBJECT)" == "-DPERL_OBJECT" -$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain$(o) $(DLL_OBJ) $(WIN32_OBJ) - $(LINK32) -subsystem:console -out:perl.exe $(LINK_FLAGS) $(LIBFILES) \ - perlmain$(o) $(DLL_OBJ) $(WIN32_OBJ) $(WINIOMAYBE) $(PERLIMPLIB) - copy perl.exe $@ - del perl.exe - copy splittree.pl .. - $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto" + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \ + $(OBJOUT_FLAG)win32mt$(o) win32.c -$(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ) $(DLL_OBJ) - $(LINK32) -subsystem:console -out:perl95.exe $(LINK_FLAGS) $(LIBFILES) \ - $(DLL_OBJ) $(PERL95_OBJ) $(PERLIMPLIB) - copy perl95.exe $@ - del perl95.exe - -!ELSE - -$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain$(o) - $(LINK32) -subsystem:console -out:perl.exe $(LINK_FLAGS) $(LIBFILES) \ - perlmain$(o) $(WINIOMAYBE) $(PERLIMPLIB) - copy perl.exe $@ - del perl.exe - copy splittree.pl .. - $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto" +DynaLoadmt$(o) : $(DYNALOADER).c + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \ + $(OBJOUT_FLAG)DynaLoadmt$(o) $(DYNALOADER).c $(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ) - $(LINK32) -subsystem:console -out:perl95.exe $(LINK_FLAGS) $(LIBFILES) \ - $(PERL95_OBJ) $(PERLIMPLIB) - copy perl95.exe $@ - del perl95.exe + $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(LINK_FLAGS) \ + $(LIBFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib -!ENDIF - -$(DYNALOADER).c: $(CONFIGPM) $(EXTDIR)\DynaLoader\dl_win32.xs - if not exist ..\lib\auto mkdir ..\lib\auto +$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM) + if not exist $(AUTODIR) mkdir $(AUTODIR) $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL) cd $(EXTDIR)\$(*B) $(XSUBPP) dl_win32.xs > $(*B).c @@ -635,7 +596,7 @@ $(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs $(MAKE) cd ..\..\win32 -$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs +$(IO_DLL): $(PERLEXE) $(IO).xs cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl $(MAKE) @@ -667,7 +628,7 @@ $(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs doc: $(PERLEXE) cd ..\pod - $(MAKE) OBJECTDEF=$(OBJECT) -f ..\win32\pod.mak checkpods pod2html pod2latex \ + $(MAKE) -f ..\win32\pod.mak checkpods pod2html pod2latex \ pod2man pod2text $(XCOPY) *.bat ..\win32\bin\*.* cd ..\win32 @@ -683,27 +644,27 @@ utils: $(PERLEXE) $(PERLEXE) ..\win32\$(PL2BAT) h2xs perldoc pstruct $(XCOPY) *.bat ..\win32\bin\*.* cd ..\win32 - $(PERLEXE) $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \ + $(PERLEXE) -I..\lib $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \ bin\pl2bat.pl bin\perlglob.pl distclean: clean -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \ $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD) -del /f *.def *.map - -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \ - $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL) - -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \ - $(DYNALOADER).c $(ATTRS).c $(THREAD).c $(B).c + -del /f $(EXTENSION_DLL) + -del /f $(EXTENSION_C) -del /f $(PODDIR)\*.html -del /f $(PODDIR)\*.bat - -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c \ - config.h.new perl95.c + -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new + -del /f ..\lib\Config.pm + -del /f perl95.c -del /f bin\*.bat - -rmdir /s /q ..\lib\auto || rmdir /s ..\lib\auto - -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR) cd $(EXTDIR) -del /s *.lib *.def *.map *.bs Makefile *$(o) pm_to_blib cd ..\win32 + -rmdir /s /q $(AUTODIR) || rmdir /s $(AUTODIR) + -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR) + -rmdir /s /q $(MINIDIR) || rmdir /s $(MINIDIR) install : all doc utils $(PERLEXE) ..\installperl @@ -715,7 +676,7 @@ install : all doc utils inst_lib : $(CONFIGPM) copy splittree.pl .. - $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto" + $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) $(RCOPY) ..\lib $(INST_LIB)\*.* minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils @@ -744,6 +705,7 @@ test-notty : test-prep cd ..\win32 clean : + -@erase miniperlmain$(o) -@erase $(MINIPERL) -@erase perlglob$(o) -@erase perlmain$(o) @@ -753,7 +715,7 @@ clean : -@erase $(PERLEXE) -@erase $(PERLDLL) -@erase $(CORE_OBJ) - if exist "$(MINIDIR)\$(NULL)" rmdir /s /q "$(MINIDIR)" + -rmdir /s /q "$(MINIDIR)" -@erase $(WIN32_OBJ) -@erase $(DLL_OBJ) -@erase $(X2P_OBJ) @@ -762,4 +724,3 @@ clean : -@erase ..\x2p\*.exe ..\x2p\*.bat -@erase *.ilk -@erase *.pdb - diff --git a/win32/config_H.bc b/win32/config_H.bc index bcdc0b8..a5306b1 100644 --- a/win32/config_H.bc +++ b/win32/config_H.bc @@ -1150,7 +1150,7 @@ /* MYMALLOC: * This symbol, if defined, indicates that we're using our own malloc. */ -#define MYMALLOC /**/ +/*#define MYMALLOC /**/ /* Mode_t: * This symbol holds the type used to declare file modes diff --git a/win32/config_H.gc b/win32/config_H.gc index eef1a63..f053e53 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -1150,7 +1150,7 @@ /* MYMALLOC: * This symbol, if defined, indicates that we're using our own malloc. */ -#define MYMALLOC /**/ +/*#define MYMALLOC /**/ /* Mode_t: * This symbol holds the type used to declare file modes diff --git a/win32/config_H.vc b/win32/config_H.vc index ac3487f..5795923 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -1157,7 +1157,7 @@ /* MYMALLOC: * This symbol, if defined, indicates that we're using our own malloc. */ -#define MYMALLOC /**/ +/*#define MYMALLOC /**/ /* Mode_t: * This symbol holds the type used to declare file modes diff --git a/win32/makedef.pl b/win32/makedef.pl index 07dfa04..e688eb5 100644 --- a/win32/makedef.pl +++ b/win32/makedef.pl @@ -33,6 +33,14 @@ close(CFG); warn join(' ',keys %define)."\n"; +if ($define{PERL_OBJECT}) { + print "LIBRARY PerlCore\n"; + print "DESCRIPTION 'Perl interpreter'\n"; + print "EXPORTS\n"; + output_symbol("perl_alloc"); + exit(0); +} + if ($CCTYPE ne 'GCC') { print "LIBRARY Perl\n"; @@ -386,25 +394,7 @@ while () { foreach my $symbol (sort keys %export) { - if ($CCTYPE eq "BORLAND") { - # workaround Borland quirk by exporting both the straight - # name and a name with leading underscore. Note the - # alias *must* come after the symbol itself, if both - # are to be exported. (Linker bug?) - print "\t_$symbol\n"; - print "\t$symbol = _$symbol\n"; - } - elsif ($CCTYPE eq 'GCC') { - # Symbols have leading _ whole process is $%£"% slow - # so skip aliases for now - print "\t$symbol\n"; - } - else { - # for binary coexistence, export both the symbol and - # alias with leading underscore - print "\t$symbol\n"; - print "\t_$symbol = $symbol\n"; - } + output_symbol($symbol); } sub emit_symbol { @@ -413,6 +403,29 @@ sub emit_symbol { $export{$symbol} = 1; } +sub output_symbol { + my $symbol = shift; + if ($CCTYPE eq "BORLAND") { + # workaround Borland quirk by exporting both the straight + # name and a name with leading underscore. Note the + # alias *must* come after the symbol itself, if both + # are to be exported. (Linker bug?) + print "\t_$symbol\n"; + print "\t$symbol = _$symbol\n"; + } + elsif ($CCTYPE eq 'GCC') { + # Symbols have leading _ whole process is $%£"% slow + # so skip aliases for now + print "\t$symbol\n"; + } + else { + # for binary coexistence, export both the symbol and + # alias with leading underscore + print "\t$symbol\n"; + print "\t_$symbol = $symbol\n"; + } +} + 1; __DATA__ # extra globals not included above. diff --git a/win32/makefile.mk b/win32/makefile.mk index 789cf82..ee329b9 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -28,7 +28,7 @@ CCTYPE *= BORLAND # # uncomment next line if you want to use the perl object -#OBJECT *= -DPERL_OBJECT +OBJECT *= -DPERL_OBJECT # # uncomment next line if you want debug version of perl (big,slow) @@ -49,7 +49,7 @@ CCTYPE *= BORLAND # WARNING: Turning this on/off WILL break binary compatibility with extensions # you may have compiled with/without it. Be prepared to recompile all extensions # if you change the default. -PERL_MALLOC *= define +#PERL_MALLOC *= define # # set the install locations of the compiler include/libraries @@ -67,29 +67,29 @@ CCLIBDIR *= $(CCHOME)\lib # # set this to your email address (perl will guess a value from # from your loginname and your hostname, which may not be right) -#EMAIL *= +#EMAIL *= ##################### CHANGE THESE ONLY IF YOU MUST ##################### .IF "$(CRYPT_SRC)$(CRYPT_LIB)" == "" -D_CRYPT=undef +D_CRYPT = undef .ELSE -D_CRYPT=define -CRYPT_FLAG=-DHAVE_DES_FCRYPT +D_CRYPT = define +CRYPT_FLAG = -DHAVE_DES_FCRYPT .ENDIF -.IF "$(PERL_MALLOC)" == "" -PERL_MALLOC *= undef +.IF "$(OBJECT)" != "" +PERL_MALLOC != undef .ENDIF +PERL_MALLOC *= undef + +USE_THREADS *= undef + #BUILDOPT *= -DMULTIPLICITY #BUILDOPT *= -DPERL_GLOBAL_STRUCT -DMULTIPLICITY # -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include -.IF "$(USE_THREADS)" == "" -USE_THREADS = undef -.ENDIF - .IMPORT .IGNORE : PROCESSOR_ARCHITECTURE PROCESSOR_ARCHITECTURE *= x86 @@ -102,6 +102,7 @@ ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE) ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE +AUTODIR = ..\lib\auto # # Programs to compile, build .lib files and link @@ -111,145 +112,150 @@ COREDIR = ..\lib\CORE .IF "$(CCTYPE)" == "BORLAND" -CC = bcc32 -LINK32 = tlink32 -LIB32 = tlib -IMPLIB = implib -c +CC = bcc32 +LINK32 = tlink32 +LIB32 = tlib +IMPLIB = implib -c # # Options # -RUNTIME = -D_RTLDLL -INCLUDES = -I.\include -I. -I.. -I$(CCINCDIR) -#PCHFLAGS = -H -H$(INTDIR)\bcmoduls.pch -DEFINES = -DWIN32 $(BUILDOPT) $(CRYPT_FLAG) $(OBJECT) -LOCDEFS = -DPERLDLL -DPERL_CORE -SUBSYS = console -LIBC = cw32mti.lib -LIBFILES = $(CRYPT_LIB) import32.lib $(LIBC) odbc32.lib odbccp32.lib +RUNTIME = -D_RTLDLL +INCLUDES = -I.\include -I. -I.. -I$(CCINCDIR) +#PCHFLAGS = -H -H$(INTDIR)\bcmoduls.pch +DEFINES = -DWIN32 $(BUILDOPT) $(CRYPT_FLAG) +LOCDEFS = -DPERLDLL -DPERL_CORE +SUBSYS = console +CXX_FLAG = -P -WINIOMAYBE = +LIBC = cw32mti.lib +LIBFILES = $(CRYPT_LIB) import32.lib $(LIBC) odbc32.lib odbccp32.lib .IF "$(CFG)" == "Debug" -OPTIMIZE = -v $(RUNTIME) -DDEBUGGING -LINK_DBG = -v +OPTIMIZE = -v $(RUNTIME) -DDEBUGGING +LINK_DBG = -v .ELSE -OPTIMIZE = -5 -O2 $(RUNTIME) -LINK_DBG = +OPTIMIZE = -5 -O2 $(RUNTIME) +LINK_DBG = .ENDIF -.IF "$(OBJECT)" == "-DPERL_OBJECT" -CFLAGS = -w -d -tWM -tWD -P $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) -.ELSE -CFLAGS = -w -d -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) -.ENDIF -LINK_FLAGS = $(LINK_DBG) -L$(CCLIBDIR) -OBJOUT_FLAG = -o -EXEOUT_FLAG = -e +CFLAGS = -w -d -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) \ + $(PCHFLAGS) $(OPTIMIZE) +LINK_FLAGS = $(LINK_DBG) -L$(CCLIBDIR) +OBJOUT_FLAG = -o +EXEOUT_FLAG = -e .ELIF "$(CCTYPE)" == "GCC" -CC = gcc -pipe -LINK32 = gcc -pipe -LIB32 = ar -IMPLIB = dlltool +CC = gcc -pipe +LINK32 = gcc -pipe +LIB32 = ar +IMPLIB = dlltool o = .o # # Options # -RUNTIME = -INCLUDES = -I.\include -I. -I.. -DEFINES = -DWIN32 $(BUILDOPT) $(CRYPT_FLAG) $(OBJECT) -LOCDEFS = -DPERLDLL -DPERL_CORE -SUBSYS = console -LIBC = -lcrtdll -LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lwsock32 -lmingw32 -lgcc -lmoldname $(LIBC) \ - -lkernel32 +RUNTIME = +INCLUDES = -I.\include -I. -I.. +DEFINES = -DWIN32 $(BUILDOPT) $(CRYPT_FLAG) +LOCDEFS = -DPERLDLL -DPERL_CORE +SUBSYS = console +CXX_FLAG = -xc++ -WINIOMAYBE = +LIBC = -lcrtdll +LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lwsock32 -lmingw32 -lgcc \ + -lmoldname $(LIBC) -lkernel32 .IF "$(CFG)" == "Debug" -OPTIMIZE = -g -O2 $(RUNTIME) -DDEBUGGING -LINK_DBG = -g +OPTIMIZE = -g -O2 $(RUNTIME) -DDEBUGGING +LINK_DBG = -g .ELSE -OPTIMIZE = -g -O2 $(RUNTIME) -LINK_DBG = +OPTIMIZE = -g -O2 $(RUNTIME) +LINK_DBG = .ENDIF -.IF "$(OBJECT)" == "-DPERL_OBJECT" -CFLAGS = $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE) -.ELSE -CFLAGS = $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE) -.ENDIF -LINK_FLAGS = $(LINK_DBG) -L$(CCLIBDIR) -OBJOUT_FLAG = -o -EXEOUT_FLAG = -o +CFLAGS = $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE) +LINK_FLAGS = $(LINK_DBG) -L$(CCLIBDIR) +OBJOUT_FLAG = -o +EXEOUT_FLAG = -o .ELSE -CC=cl.exe -LINK32=link.exe -LIB32=$(LINK32) -lib +CC = cl.exe +LINK32 = link.exe +LIB32 = $(LINK32) -lib + # # Options # -.IF "$(RUNTIME)" == "" -RUNTIME = -MD +.IF "$(OBJECT)" == "-DPERL_OBJECT" +RUNTIME = -MT +# XXX building with -MD fails many tests, but cannot investigate +# because building with debug crashes compiler :-( GSAR )-: +#RUNTIME = -MD +.ELSE +RUNTIME = -MD .ENDIF -INCLUDES = -I.\include -I. -I.. -#PCHFLAGS = -Fp$(INTDIR)\vcmoduls.pch -YX -DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG) $(OBJECT) -LOCDEFS = -DPERLDLL -DPERL_CORE -SUBSYS = console + +INCLUDES = -I.\include -I. -I.. +#PCHFLAGS = -Fp$(INTDIR)\vcmoduls.pch -YX +DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG) +LOCDEFS = -DPERLDLL -DPERL_CORE +SUBSYS = console +CXX_FLAG = -TP -GX .IF "$(RUNTIME)" == "-MD" -LIBC = msvcrt.lib -WINIOMAYBE = +LIBC = msvcrt.lib .ELSE -LIBC = libcmt.lib -WINIOMAYBE = +LIBC = libcmt.lib .ENDIF .IF "$(CFG)" == "Debug" .IF "$(CCTYPE)" == "MSVC20" -OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING +OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING .ELSE -OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG -DDEBUGGING +OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG -DDEBUGGING .ENDIF -LINK_DBG = -debug -pdb:none +LINK_DBG = -debug -pdb:none .ELSE .IF "$(CCTYPE)" == "MSVC20" -OPTIMIZE = -O1 $(RUNTIME) -DNDEBUG +OPTIMIZE = -Od $(RUNTIME) -DNDEBUG .ELSE -OPTIMIZE = -O1 $(RUNTIME) -DNDEBUG +OPTIMIZE = -Od $(RUNTIME) -DNDEBUG .ENDIF -LINK_DBG = -release +LINK_DBG = -release .ENDIF -# we don't add LIBC here, the compiler do it based on -MD/-MT -LIBFILES = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \ - winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \ - oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \ - version.lib odbc32.lib odbccp32.lib +# we don't add LIBC here, the compiler does it based on -MD/-MT +LIBFILES = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \ + winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \ + oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \ + version.lib odbc32.lib odbccp32.lib + +CFLAGS = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \ + $(PCHFLAGS) $(OPTIMIZE) +LINK_FLAGS = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE) +OBJOUT_FLAG = -Fo +EXEOUT_FLAG = -Fe -.IF "$(OBJECT)" == "-DPERL_OBJECT" -CFLAGS = -nologo -Gf -W3 -TP $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) -.ELSE -CFLAGS = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE) .ENDIF -LINK_FLAGS = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE) -OBJOUT_FLAG = -Fo -EXEOUT_FLAG = -Fe +.IF "$(OBJECT)" != "" +OPTIMIZE += $(CXX_FLAG) .ENDIF +CFLAGS_O = $(CFLAGS) $(OBJECT) + #################### do not edit below this line ####################### ############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ############## o *= .obj +LKPRE = INPUT ( +LKPOST = ) + # # Rules # @@ -257,7 +263,7 @@ o *= .obj .SUFFIXES : .c $(o) .dll .lib .exe .a .c$(o): - $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS) $(OBJOUT_FLAG)$@ $< + $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $< .y.c: $(NOOP) @@ -275,255 +281,266 @@ $(o).dll: .ENDIF # -INST_BIN=$(INST_TOP)\bin -INST_LIB=$(INST_TOP)\lib -INST_POD=$(INST_LIB)\pod -INST_HTML=$(INST_POD)\html -LIBDIR=..\lib -EXTDIR=..\ext -PODDIR=..\pod -EXTUTILSDIR=$(LIBDIR)\extutils +INST_BIN = $(INST_TOP)\bin +INST_LIB = $(INST_TOP)\lib +INST_POD = $(INST_LIB)\pod +INST_HTML = $(INST_POD)\html +LIBDIR = ..\lib +EXTDIR = ..\ext +PODDIR = ..\pod +EXTUTILSDIR = $(LIBDIR)\extutils # # various targets -PERLIMPLIB=..\perl.lib -MINIPERL=..\miniperl.exe -PERLDLL=..\perl.dll -PERLEXE=..\perl.exe -GLOBEXE=..\perlglob.exe -CONFIGPM=..\lib\Config.pm -MINIMOD=..\lib\ExtUtils\Miniperl.pm -X2P=..\x2p\a2p.exe - -PL2BAT=bin\pl2bat.pl -GLOBBAT = bin\perlglob.bat +.IF "$(OBJECT)" == "-DPERL_OBJECT" +PERLIMPLIB = ..\perlcore.lib +PERLDLL = ..\perlcore.dll +.ELSE +PERLIMPLIB = ..\perl.lib +PERLDLL = ..\perl.dll +.ENDIF + +MINIPERL = ..\miniperl.exe +MINIDIR = .\mini +PERLEXE = ..\perl.exe +GLOBEXE = ..\perlglob.exe +CONFIGPM = ..\lib\Config.pm +MINIMOD = ..\lib\ExtUtils\Miniperl.pm +X2P = ..\x2p\a2p.exe + +PL2BAT = bin\pl2bat.pl +GLOBBAT = bin\perlglob.bat .IF "$(CCTYPE)" == "BORLAND" -CFGSH_TMPL = config.bc -CFGH_TMPL = config_H.bc +CFGSH_TMPL = config.bc +CFGH_TMPL = config_H.bc .ELIF "$(CCTYPE)" == "GCC" -CFGSH_TMPL = config.gc -CFGH_TMPL = config_H.gc +CFGSH_TMPL = config.gc +CFGH_TMPL = config_H.gc .ELSE -CFGSH_TMPL = config.vc -CFGH_TMPL = config_H.vc -PERL95EXE=..\perl95.exe +CFGSH_TMPL = config.vc +CFGH_TMPL = config_H.vc +PERL95EXE = ..\perl95.exe .ENDIF -XCOPY=xcopy /f /r /i /d -RCOPY=xcopy /f /r /i /e /d -NOOP=@echo -#NULL= +XCOPY = xcopy /f /r /i /d +RCOPY = xcopy /f /r /i /e /d +NOOP = @echo -.IF "$(CRYPT_SRC)" != "" -CRYPT_OBJ=$(CRYPT_SRC:db:+$(o)) -.ENDIF +# filenames given to xsubpp must have forward slashes (since it puts +# full pathnames in #line strings) +XSUBPP = ..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp \ + -C++ -prototypes + +CORE_SRC = \ + ..\av.c \ + ..\byterun.c \ + ..\deb.c \ + ..\doio.c \ + ..\doop.c \ + ..\dump.c \ + ..\globals.c \ + ..\gv.c \ + ..\hv.c \ + ..\mg.c \ + ..\op.c \ + ..\perl.c \ + ..\perly.c \ + ..\pp.c \ + ..\pp_ctl.c \ + ..\pp_hot.c \ + ..\pp_sys.c \ + ..\regcomp.c \ + ..\regexec.c \ + ..\run.c \ + ..\scope.c \ + ..\sv.c \ + ..\taint.c \ + ..\toke.c \ + ..\universal.c \ + ..\util.c + +CORE_SRC += $(CRYPT_SRC) .IF "$(PERL_MALLOC)" == "define" -MALLOC_SRC = ..\malloc.c -MALLOC_OBJ = ..\malloc$(o) +CORE_SRC += ..\malloc.c .ENDIF -# -# filenames given to xsubpp must have forward slashes (since it puts -# full pathnames in #line strings) -XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes - -CORE_C= ..\av.c \ - ..\byterun.c \ - ..\deb.c \ - ..\doio.c \ - ..\doop.c \ - ..\dump.c \ - ..\globals.c \ - ..\gv.c \ - ..\hv.c \ - ..\mg.c \ - ..\op.c \ - ..\perl.c \ - ..\perlio.c \ - ..\perly.c \ - ..\pp.c \ - ..\pp_ctl.c \ - ..\pp_hot.c \ - ..\pp_sys.c \ - ..\regcomp.c \ - ..\regexec.c \ - ..\run.c \ - ..\scope.c \ - ..\sv.c \ - ..\taint.c \ - ..\toke.c \ - ..\universal.c \ - ..\util.c \ - $(MALLOC_SRC) \ - $(CRYPT_SRC) - -CORE_OBJ= ..\av$(o) \ - ..\byterun$(o) \ - ..\deb$(o) \ - ..\doio$(o) \ - ..\doop$(o) \ - ..\dump$(o) \ - ..\globals$(o) \ - ..\gv$(o) \ - ..\hv$(o) \ - ..\mg$(o) \ - ..\op$(o) \ - ..\perl$(o) \ - ..\perlio$(o) \ - ..\perly$(o) \ - ..\pp$(o) \ - ..\pp_ctl$(o) \ - ..\pp_hot$(o) \ - ..\pp_sys$(o) \ - ..\regcomp$(o) \ - ..\regexec$(o) \ - ..\run$(o) \ - ..\scope$(o) \ - ..\sv$(o) \ - ..\taint$(o) \ - ..\toke$(o) \ - ..\universal$(o)\ - ..\util$(o) \ - $(MALLOC_OBJ) \ - $(CRYPT_OBJ) - -WIN32_C = perllib.c \ - win32.c \ - win32sck.c \ - win32thread.c - -WIN32_OBJ = win32$(o) \ - win32sck$(o) \ - win32thread$(o) - -PERL95_OBJ = perl95$(o) \ - win32mt$(o) \ - win32sckmt$(o) \ - $(CRYPT_OBJ) - -DLL_OBJ = perllib$(o) $(DYNALOADER)$(o) - -X2P_OBJ = ..\x2p\a2p$(o) \ - ..\x2p\hash$(o) \ - ..\x2p\str$(o) \ - ..\x2p\util$(o) \ - ..\x2p\walk$(o) - -CORE_H = ..\av.h \ - ..\byterun.h \ - ..\bytecode.h \ - ..\cop.h \ - ..\cv.h \ - ..\dosish.h \ - ..\embed.h \ - ..\form.h \ - ..\gv.h \ - ..\handy.h \ - ..\hv.h \ - ..\mg.h \ - ..\nostdio.h \ - ..\op.h \ - ..\opcode.h \ - ..\perl.h \ - ..\perlio.h \ - ..\perlsdio.h \ - ..\perlsfio.h \ - ..\perly.h \ - ..\pp.h \ - ..\proto.h \ - ..\regexp.h \ - ..\scope.h \ - ..\sv.h \ - ..\thread.h \ - ..\unixish.h \ - ..\util.h \ - ..\XSUB.h \ - .\config.h \ - ..\EXTERN.h \ - ..\perlvars.h \ - ..\intrpvar.h \ - ..\thrdvar.h \ - .\include\dirent.h \ - .\include\netdb.h \ - .\include\sys\socket.h \ - .\win32.h - -DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File attrs Thread B -STATIC_EXT=DynaLoader - -DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader -SOCKET=$(EXTDIR)\Socket\Socket -FCNTL=$(EXTDIR)\Fcntl\Fcntl -OPCODE=$(EXTDIR)\Opcode\Opcode -SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File -IO=$(EXTDIR)\IO\IO -ATTRS=$(EXTDIR)\attrs\attrs -THREAD=$(EXTDIR)\Thread\Thread -B=$(EXTDIR)\B\B - -SOCKET_DLL=..\lib\auto\Socket\Socket.dll -FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll -OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll -SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll -IO_DLL=..\lib\auto\IO\IO.dll -ATTRS_DLL=..\lib\auto\attrs\attrs.dll -THREAD_DLL=..\lib\auto\Thread\Thread.dll -B_DLL=..\lib\auto\B\B.dll - -STATICLINKMODULES=DynaLoader -DYNALOADMODULES= \ - $(SOCKET_DLL) \ - $(FCNTL_DLL) \ - $(OPCODE_DLL) \ - $(SDBM_FILE_DLL)\ - $(IO_DLL) \ - $(ATTRS_DLL) \ - $(THREAD_DLL) \ - $(B_DLL) - -POD2HTML=$(PODDIR)\pod2html -POD2MAN=$(PODDIR)\pod2man -POD2LATEX=$(PODDIR)\pod2latex -POD2TEXT=$(PODDIR)\pod2text - -CFG_VARS= "INST_DRV=$(INST_DRV)" \ - "INST_TOP=$(INST_TOP)" \ - "archname=$(ARCHNAME)" \ - "cc=$(CC)" \ - "ccflags=$(OPTIMIZE) $(DEFINES)" \ - "cf_email=$(EMAIL)" \ - "d_crypt=$(D_CRYPT)" \ - "d_mymalloc=$(PERL_MALLOC)" \ - "libs=$(LIBFILES:f)" \ - "incpath=$(CCINCDIR)" \ - "libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" \ - "libc=$(LIBC)" \ - "static_ext=$(STATIC_EXT)" \ - "dynamic_ext=$(DYNAMIC_EXT)" \ - "usethreads=$(USE_THREADS)" \ - "LINK_FLAGS=$(LINK_FLAGS)" \ - "optimize=$(OPTIMIZE)" +.IF "$(OBJECT)" == "" +CORE_SRC += ..\perlio.c +.ENDIF + +WIN32_SRC = \ + .\win32.c \ + .\win32sck.c + +.IF "$(USE_THREADS)" == "define" || "$(OBJECT)" == "" +WIN32_SRC += .\win32thread.c +.ENDIF + +PERL95_SRC = \ + perl95.c \ + win32mt.c \ + win32sckmt.c + +DLL_SRC = $(DYNALOADER).c + + +.IF "$(OBJECT)" == "" +DLL_SRC += perllib.c +.ENDIF + +X2P_SRC = \ + ..\x2p\a2p.c \ + ..\x2p\hash.c \ + ..\x2p\str.c \ + ..\x2p\util.c \ + ..\x2p\walk.c + +CORE_H = \ + ..\av.h \ + ..\byterun.h \ + ..\bytecode.h \ + ..\cop.h \ + ..\cv.h \ + ..\dosish.h \ + ..\embed.h \ + ..\form.h \ + ..\gv.h \ + ..\handy.h \ + ..\hv.h \ + ..\mg.h \ + ..\nostdio.h \ + ..\op.h \ + ..\opcode.h \ + ..\perl.h \ + ..\perlio.h \ + ..\perlsdio.h \ + ..\perlsfio.h \ + ..\perly.h \ + ..\pp.h \ + ..\proto.h \ + ..\regexp.h \ + ..\scope.h \ + ..\sv.h \ + ..\thread.h \ + ..\unixish.h \ + ..\util.h \ + ..\XSUB.h \ + .\config.h \ + ..\EXTERN.h \ + ..\perlvars.h \ + ..\intrpvar.h \ + ..\thrdvar.h \ + .\include\dirent.h \ + .\include\netdb.h \ + .\include\sys\socket.h \ + .\win32.h + +CORE_OBJ = $(CORE_SRC:db:+$(o)) +WIN32_OBJ = $(WIN32_SRC:db:+$(o)) +MINICORE_OBJ = $(MINIDIR)\{$(CORE_OBJ:f) perlio$(o) miniperlmain$(o)} +MINIWIN32_OBJ = $(MINIDIR)\{$(WIN32_OBJ:f)} +MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ) +PERL95_OBJ = $(PERL95_SRC:db:+$(o)) DynaLoadmt$(o) +DLL_OBJ = $(DLL_SRC:db:+$(o)) +X2P_OBJ = $(X2P_SRC:db:+$(o)) + +PERLDLL_OBJ = $(CORE_OBJ) +PERLEXE_OBJ = perlmain$(o) + +.IF "$(OBJECT)" == "" +PERLDLL_OBJ += $(WIN32_OBJ) $(DLL_OBJ) +.ELSE +PERLEXE_OBJ += $(WIN32_OBJ) $(DLL_OBJ) +.ENDIF + +DYNAMIC_EXT = Socket IO Fcntl Opcode SDBM_File attrs Thread B +STATIC_EXT = DynaLoader + +DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader +SOCKET = $(EXTDIR)\Socket\Socket +FCNTL = $(EXTDIR)\Fcntl\Fcntl +OPCODE = $(EXTDIR)\Opcode\Opcode +SDBM_FILE = $(EXTDIR)\SDBM_File\SDBM_File +IO = $(EXTDIR)\IO\IO +ATTRS = $(EXTDIR)\attrs\attrs +THREAD = $(EXTDIR)\Thread\Thread +B = $(EXTDIR)\B\B + +SOCKET_DLL = $(AUTODIR)\Socket\Socket.dll +FCNTL_DLL = $(AUTODIR)\Fcntl\Fcntl.dll +OPCODE_DLL = $(AUTODIR)\Opcode\Opcode.dll +SDBM_FILE_DLL = $(AUTODIR)\SDBM_File\SDBM_File.dll +IO_DLL = $(AUTODIR)\IO\IO.dll +ATTRS_DLL = $(AUTODIR)\attrs\attrs.dll +THREAD_DLL = $(AUTODIR)\Thread\Thread.dll +B_DLL = $(AUTODIR)\B\B.dll + +EXTENSION_C = \ + $(SOCKET).c \ + $(FCNTL).c \ + $(OPCODE).c \ + $(SDBM_FILE).c \ + $(IO).c \ + $(ATTRS).c \ + $(THREAD).c \ + $(B).c + +EXTENSION_DLL = \ + $(SOCKET_DLL) \ + $(FCNTL_DLL) \ + $(OPCODE_DLL) \ + $(SDBM_FILE_DLL)\ + $(IO_DLL) \ + $(ATTRS_DLL) +# $(THREAD_DLL) \ +# $(B_DLL) + +POD2HTML = $(PODDIR)\pod2html +POD2MAN = $(PODDIR)\pod2man +POD2LATEX = $(PODDIR)\pod2latex +POD2TEXT = $(PODDIR)\pod2text + +CFG_VARS = \ + "INST_DRV=$(INST_DRV)" \ + "INST_TOP=$(INST_TOP)" \ + "archname=$(ARCHNAME)" \ + "cc=$(CC)" \ + "ccflags=$(OPTIMIZE) $(DEFINES) $(OBJECT)" \ + "cf_email=$(EMAIL)" \ + "d_crypt=$(D_CRYPT)" \ + "d_mymalloc=$(PERL_MALLOC)" \ + "libs=$(LIBFILES:f)" \ + "incpath=$(CCINCDIR)" \ + "libperl=$(PERLIMPLIB)" \ + "libpth=$(strip $(CCLIBDIR) $(LIBFILES:d))" \ + "libc=$(LIBC)" \ + "make=dmake" \ + "static_ext=$(STATIC_EXT)" \ + "dynamic_ext=$(DYNAMIC_EXT)" \ + "usethreads=$(USE_THREADS)" \ + "LINK_FLAGS=$(LINK_FLAGS)" \ + "optimize=$(OPTIMIZE)" # # Top targets # -all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) \ - $(X2P) +all : $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) $(X2P) \ + $(EXTENSION_DLL) $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c #------------------------------------------------------------ -$(GLOBEXE): perlglob$(o) +$(GLOBEXE) : perlglob$(o) .IF "$(CCTYPE)" == "BORLAND" $(CC) -c -w -v -tWM -I$(CCINCDIR) perlglob.c $(LINK32) -Tpe -ap $(LINK_FLAGS) c0x32$(o) perlglob$(o) \ @@ -537,8 +554,6 @@ $(GLOBEXE): perlglob$(o) perlglob$(o) : perlglob.c -..\miniperlmain$(o) : ..\miniperlmain.c $(CORE_H) - config.w32 : $(CFGSH_TMPL) copy $(CFGSH_TMPL) config.w32 @@ -569,58 +584,60 @@ $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl $(RCOPY) include $(COREDIR)\*.* $(MINIPERL) -I..\lib config_h.PL || $(MAKE) $(MAKEMACROS) $(CONFIGPM) -LKPRE = INPUT ( -LKPOST = ) - -$(MINIPERL) : ..\miniperlmain$(o) $(CORE_OBJ) $(WIN32_OBJ) +$(MINIPERL) : $(MINIDIR) $(MINI_OBJ) .IF "$(CCTYPE)" == "BORLAND" $(LINK32) -Tpe -ap $(LINK_FLAGS) \ - @$(mktmp c0x32$(o) ..\miniperlmain$(o) \ - $(CORE_OBJ:s,\,\\) $(WIN32_OBJ:s,\,\\),$(@:s,\,\\),,$(LIBFILES),) + @$(mktmp c0x32$(o) $(MINI_OBJ:s,\,\\),$(@:s,\,\\),,$(LIBFILES),) .ELIF "$(CCTYPE)" == "GCC" $(LINK32) -v -o $@ $(LINK_FLAGS) \ - $(mktmp $(LKPRE) ..\miniperlmain$(o) \ - $(CORE_OBJ:s,\,\\) $(WIN32_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) + $(mktmp $(LKPRE) $(MINI_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) .ELSE $(LINK32) -subsystem:console -out:$@ \ - @$(mktmp $(LINK_FLAGS) $(LIBFILES) ..\miniperlmain$(o) \ - $(CORE_OBJ:s,\,\\) $(WIN32_OBJ:s,\,\\)) + @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ:s,\,\\)) .ENDIF -$(WIN32_OBJ) : $(CORE_H) -$(CORE_OBJ) : $(CORE_H) -$(DLL_OBJ) : $(CORE_H) -$(X2P_OBJ) : $(CORE_H) +$(MINIDIR) : + if not exist "$(MINIDIR)" mkdir "$(MINIDIR)" + +$(MINICORE_OBJ) : $(CORE_H) + $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ ..\$(*B).c + +$(MINIWIN32_OBJ) : $(CORE_H) + $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*B).c + +$(WIN32_OBJ) : $(CORE_H) +$(CORE_OBJ) : $(CORE_H) +$(MINI_OBJ) : $(CORE_H) +$(DLL_OBJ) : $(CORE_H) +$(PERL95_OBJ) : $(CORE_H) +$(X2P_OBJ) : $(CORE_H) perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym makedef.pl - $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) \ + $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) $(OBJECT) \ CCTYPE=$(CCTYPE) > perldll.def -$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ) +$(PERLDLL): perldll.def $(PERLDLL_OBJ) .IF "$(CCTYPE)" == "BORLAND" $(LINK32) -Tpd -ap $(LINK_FLAGS) \ - @$(mktmp c0d32$(o) $(CORE_OBJ:s,\,\\) \ - $(WIN32_OBJ:s,\,\\) $(DLL_OBJ:s,\,\\)\n \ + @$(mktmp c0d32$(o) $(PERLDLL_OBJ:s,\,\\)\n \ $@,\n \ $(LIBFILES)\n \ perldll.def\n) $(IMPLIB) $*.lib $@ .ELIF "$(CCTYPE)" == "GCC" $(LINK32) -mdll -o $@ -Wl,--base-file -Wl,perl.base $(LINK_FLAGS) \ - $(mktmp $(LKPRE) $(CORE_OBJ:s,\,\\) $(WIN32_OBJ:s,\,\\) \ - $(DLL_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) + $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) dlltool --output-lib $(PERLIMPLIB) \ --dllname perl.dll \ --def perldll.def \ --base-file perl.base \ --output-exp perl.exp $(LINK32) -mdll -o $@ $(LINK_FLAGS) \ - $(mktmp $(LKPRE) $(CORE_OBJ:s,\,\\) $(WIN32_OBJ:s,\,\\) \ - $(DLL_OBJ:s,\,\\) $(LIBFILES) perl.exp $(LKPOST)) + $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,\\) $(LIBFILES) \ + perl.exp $(LKPOST)) .ELSE $(LINK32) -dll -def:perldll.def -out:$@ \ - @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(CORE_OBJ:s,\,\\) \ - $(WIN32_OBJ:s,\,\\) $(DLL_OBJ:s,\,\\)) + @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ:s,\,\\)) .ENDIF $(XCOPY) $(PERLIMPLIB) $(COREDIR) @@ -630,7 +647,22 @@ perl.def : $(MINIPERL) makeperldef.pl $(MINIMOD) : $(MINIPERL) ..\minimod.pl cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm -$(X2P) : $(X2P_OBJ) +..\x2p\a2p$(o) : ..\x2p\a2p.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c + +..\x2p\hash$(o) : ..\x2p\hash.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c + +..\x2p\str$(o) : ..\x2p\str.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c + +..\x2p\util$(o) : ..\x2p\util.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c + +..\x2p\walk$(o) : ..\x2p\walk.c + $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c + +$(X2P) : $(MINIPERL) $(X2P_OBJ) $(MINIPERL) ..\x2p\find2perl.PL $(MINIPERL) ..\x2p\s2p.PL .IF "$(CCTYPE)" == "BORLAND" @@ -641,30 +673,30 @@ $(X2P) : $(X2P_OBJ) $(mktmp $(LKPRE) $(X2P_OBJ:s,\,\\) $(LIBFILES) $(LKPOST)) .ELSE $(LINK32) -subsystem:console -out:$@ \ - @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,\\) + @$(mktmp $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,\\)) .ENDIF perlmain.c : runperl.c copy runperl.c perlmain.c perlmain$(o) : perlmain.c - $(CC) $(CFLAGS) -UPERLDLL $(EXEOUT_FLAG)$@ -c perlmain.c + $(CC) $(CFLAGS_O) -UPERLDLL $(EXEOUT_FLAG)$@ -c perlmain.c -$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain$(o) +$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) .IF "$(CCTYPE)" == "BORLAND" $(LINK32) -Tpe -ap $(LINK_FLAGS) \ - @$(mktmp c0x32$(o) perlmain$(o) $(WINIOMAYBE)\n \ + @$(mktmp c0x32$(o) $(PERLEXE_OBJ)\n \ $@,\n \ $(PERLIMPLIB) $(LIBFILES)\n) .ELIF "$(CCTYPE)" == "GCC" $(LINK32) -o $@ $(LINK_FLAGS) \ - perlmain.o $(WINIOMAYBE) $(PERLIMPLIB) $(LIBFILES) + $(PERLEXE_OBJ) $(PERLIMPLIB) $(LIBFILES) .ELSE $(LINK32) -subsystem:console -out:$@ $(LINK_FLAGS) $(LIBFILES) \ - perlmain$(o) $(WINIOMAYBE) $(PERLIMPLIB) + $(PERLEXE_OBJ) $(PERLIMPLIB) .ENDIF copy splittree.pl .. - $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto" + $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) .IF "$(CCTYPE)" != "BORLAND" .IF "$(CCTYPE)" != "GCC" @@ -673,23 +705,29 @@ perl95.c : runperl.c copy runperl.c perl95.c perl95$(o) : perl95.c - $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c perl95.c + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c perl95.c win32sckmt$(o) : win32sck.c - $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32sckmt$(o) win32sck.c + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \ + $(OBJOUT_FLAG)win32sckmt$(o) win32sck.c win32mt$(o) : win32.c - $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32mt$(o) win32.c + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \ + $(OBJOUT_FLAG)win32mt$(o) win32.c + +DynaLoadmt$(o) : $(DYNALOADER).c + $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \ + $(OBJOUT_FLAG)DynaLoadmt$(o) $(DYNALOADER).c $(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ) - $(LINK32) -subsystem:console -out:$@ $(LINK_FLAGS) $(LIBFILES) \ - $(PERL95_OBJ) $(PERLIMPLIB) + $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(LINK_FLAGS) \ + $(LIBFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib .ENDIF .ENDIF $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM) - if not exist ..\lib\auto mkdir ..\lib\auto + if not exist $(AUTODIR) mkdir $(AUTODIR) $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL) cd $(EXTDIR)\$(*B) && $(XSUBPP) dl_win32.xs > $(*B).c $(XCOPY) $(EXTDIR)\$(*B)\dlutils.c . @@ -747,7 +785,7 @@ doc: $(PERLEXE) --libpod=perlfunc:perlguts:perlvar:perlrun:perlop --recurse utils: $(PERLEXE) - cd ..\utils && $(MAKE) PERL=$(MINIPERL) + cd ..\utils && $(MAKE) PERL=$(PERLEXE) cd ..\utils && $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug \ pl2pm c2ph h2xs perldoc pstruct $(XCOPY) ..\utils\*.bat bin\*.* @@ -758,20 +796,20 @@ distclean: clean -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \ $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD) -del /f *.def *.map - -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \ - $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL) - -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \ - $(DYNALOADER).c $(ATTRS).c $(THREAD).c $(B).c + -del /f $(EXTENSION_DLL) + -del /f $(EXTENSION_C) -del /f $(PODDIR)\*.html -del /f $(PODDIR)\*.bat -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new + -del /f ..\lib\Config.pm .IF "$(PERL95EXE)" != "" -del /f perl95.c .ENDIF -del /f bin\*.bat -cd $(EXTDIR) && del /s *.lib *.def *.map *.bs Makefile *$(o) pm_to_blib - -rmdir /s /q ..\lib\auto || rmdir /s ..\lib\auto + -rmdir /s /q $(AUTODIR) || rmdir /s $(AUTODIR) -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR) + -rmdir /s /q $(MINIDIR) || rmdir /s $(MINIDIR) install : all doc utils $(PERLEXE) ..\installperl @@ -785,7 +823,7 @@ install : all doc utils inst_lib : $(CONFIGPM) copy splittree.pl .. - $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto" + $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) $(RCOPY) ..\lib $(INST_LIB)\*.* minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils @@ -827,6 +865,7 @@ clean : -@erase $(PERLEXE) -@erase $(PERLDLL) -@erase $(CORE_OBJ) + -rmdir /s /q "$(MINIDIR)" -@erase $(WIN32_OBJ) -@erase $(DLL_OBJ) -@erase $(X2P_OBJ) @@ -835,5 +874,3 @@ clean : -@erase ..\x2p\*.exe ..\x2p\*.bat -@erase *.ilk -@erase *.pdb - - diff --git a/win32/runperl.c b/win32/runperl.c index d008158..cbda241 100644 --- a/win32/runperl.c +++ b/win32/runperl.c @@ -8,13 +8,9 @@ #include "XSUB.H" #include "Win32iop.h" -#undef errno -#if defined(_MT) -_CRTIMP int * __cdecl _errno(void); -#define errno (*_errno()) -#else -_CRTIMP extern int errno; -#endif +#define errno (*win32_errno()) +#define stdout (win32_stdout()) +#define stderr (win32_stderr()) CPerlObj *pPerl; @@ -94,7 +90,7 @@ public: }; virtual int Putenv(const char *envstring, int &err) { - return _putenv(envstring); + return putenv(envstring); }; virtual char* LibPath(char *sfx, ...) { @@ -493,7 +489,7 @@ public: }; virtual int Unlink(const char *filename, int &err) { - chmod(filename, _S_IREAD | _S_IWRITE); + chmod(filename, S_IREAD | S_IWRITE); CALLFUNCRET(unlink(filename)) }; virtual int Utime(char *filename, struct utimbuf *times, int &err) @@ -593,6 +589,10 @@ public: }; virtual PerlIO* Popen(const char *command, const char *mode) { +#ifdef __BORLANDC__ + win32_fflush(stdout); + win32_fflush(stderr); +#endif return (PerlIO*)win32_popen(command, mode); }; virtual int Pclose(PerlIO *stream) @@ -601,7 +601,7 @@ public: }; virtual int Pipe(int *phandles) { - return win32_pipe(phandles, 512, _O_BINARY); + return win32_pipe(phandles, 512, O_BINARY); }; virtual int Setuid(uid_t u) { @@ -716,19 +716,23 @@ public: }; virtual char* GetBase(PerlIO* pf, int &err) { - return ((FILE*)pf)->_base; + FILE *f = (FILE*)pf; + return FILE_base(f); }; virtual int GetBufsiz(PerlIO* pf, int &err) { - return ((FILE*)pf)->_bufsiz; + FILE *f = (FILE*)pf; + return FILE_bufsiz(f); }; virtual int GetCnt(PerlIO* pf, int &err) { - return ((FILE*)pf)->_cnt; + FILE *f = (FILE*)pf; + return FILE_cnt(f); }; virtual char* GetPtr(PerlIO* pf, int &err) { - return ((FILE*)pf)->_ptr; + FILE *f = (FILE*)pf; + return FILE_ptr(f); }; virtual int Putc(PerlIO* pf, int c, int &err) { @@ -791,12 +795,14 @@ public: }; virtual void SetCnt(PerlIO* pf, int n, int &err) { - ((FILE*)pf)->_cnt = n; + FILE *f = (FILE*)pf; + FILE_cnt(f) = n; }; virtual void SetPtrCnt(PerlIO* pf, char * ptr, int n, int& err) { - ((FILE*)pf)->_ptr = ptr; - ((FILE*)pf)->_cnt = n; + FILE *f = (FILE*)pf; + FILE_ptr(f) = ptr; + FILE_cnt(f) = n; }; virtual void Setlinebuf(PerlIO* pf, int &err) { @@ -876,9 +882,6 @@ public: static void xs_init _((CPERLarg)); -#define stderr (&_iob[2]) -#undef fprintf -#undef environ class CPerlHost { @@ -897,7 +900,7 @@ public: } catch(...) { - fprintf(stderr, "%s\n", "Error: Unable to construct data structures"); + win32_fprintf(stderr, "%s\n", "Error: Unable to construct data structures"); pPerl->perl_free(); pPerl = NULL; } @@ -905,7 +908,7 @@ public: } catch(...) { - fprintf(stderr, "%s\n", "Error: Unable to allocate memory"); + win32_fprintf(stderr, "%s\n", "Error: Unable to allocate memory"); pPerl = NULL; } return (pPerl != NULL); @@ -925,7 +928,7 @@ public: } catch(...) { - fprintf(stderr, "Error: Parse exception\n"); + win32_fprintf(stderr, "Error: Parse exception\n"); retVal = -1; } return retVal; @@ -944,7 +947,7 @@ public: } catch(...) { - fprintf(stderr, "Error: Runtime exception\n"); + win32_fprintf(stderr, "Error: Runtime exception\n"); retVal = -1; } return retVal; diff --git a/win32/win32.c b/win32/win32.c index 65727a4..d5caff3 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -13,6 +13,10 @@ #include #ifdef __GNUC__ #define Win32_Winsock +# ifdef __cplusplus +#undef __attribute__ /* seems broken in 2.8.0 */ +#define __attribute__(p) +# endif #endif #include @@ -2022,7 +2026,7 @@ XS(w32_DomainName) char dname[256]; DWORD dnamelen = sizeof(dname); SID_NAME_USE snu; - if (LookupAccountName(NULL, name, &sid, &sidlen, + if (LookupAccountName(NULL, name, (PSID)&sid, &sidlen, dname, &dnamelen, &snu)) { XSRETURN_PV(dname); /* all that for this */ } diff --git a/win32/win32.h b/win32/win32.h index a502978..bb2190b 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -22,6 +22,10 @@ #ifdef __GNUC__ typedef long long __int64; #define Win32_Winsock +# ifdef __cplusplus +#undef __attribute__ /* seems broken in 2.8.0 */ +#define __attribute__(p) +# endif /* GCC does not do __declspec() - render it a nop * and turn on options to avoid importing data */ @@ -133,6 +137,11 @@ struct tms { #pragma warn -csu /* "comparing signed and unsigned values" */ #pragma warn -pro /* "call to function with no prototype" */ +/* Borland is picky about a bare member function name used as its ptr */ +#ifdef PERL_OBJECT +#define FUNC_NAME_TO_PTR(name) &(name) +#endif + #endif #ifdef _MSC_VER /* Microsoft Visual C++ */ @@ -151,6 +160,13 @@ typedef long gid_t; #define flushall _flushall #define fcloseall _fcloseall +#ifndef _O_NOINHERIT +# define _O_NOINHERIT 0x0080 +# ifndef _NO_OLDNAMES +# define O_NOINHERIT _O_NOINHERIT +# endif +#endif + #endif /* __MINGW32__ */ /* compatibility stuff for other compilers goes here */ diff --git a/win32/win32sck.c b/win32/win32sck.c index 5c2b73f..6d67533 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -13,6 +13,10 @@ #define WIN32_LEAN_AND_MEAN #ifdef __GNUC__ #define Win32_Winsock +# ifdef __cplusplus +#undef __attribute__ /* seems broken in 2.8.0 */ +#define __attribute__(p) +# endif #endif #include #include "EXTERN.h"