Skip to content

Commit 4b4e451

Browse files
jmalakPerditionC
authored andcommitted
fix cross-compilation build of fixstrs.exe
the format of the response file depends on the compiler used, which is not generally correct for cross-compilation the program has been modified to define the file format via a command line option, making the file creation transparent and defined to be correct for currently used tool
1 parent 5df5e84 commit 4b4e451

File tree

9 files changed

+108
-61
lines changed

9 files changed

+108
-61
lines changed

clean.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ call %0 .\ command.com command.upx
1111
call %0 .\ lastmake.mk context.h_c context.inc strings.h infores info.txt gnuconf.mak
1212
call %0 criter\ criter criter1 context.def context.inc context.h_c
1313
call %0 strings\ command.cln xmsswap.cln strings.h strings.err strings.dat strings.log
14-
call %0 strings\strings\ makefile
14+
call %0 strings\strings\ makefile strings.mak
1515
call %0 strings\strings\*. c
1616
call %0 tools\ makefile.mak
1717
call %0 tools\*. icd

clean.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ rm -f command.com command.upx
99
rm -f lastmake.mk context.h_c context.inc strings.h infores info.txt
1010
cd strings && rm -f strings.h strings.err strings.dat strings.log
1111
cd ../criter && rm -f criter criter1 context.def context.inc context.h_c
12-
cd ../strings/strings && rm -f *.c makefile
12+
cd ../strings/strings && rm -f *.c makefile strings.mak
1313
cd ../../tools && rm -f makefile.mak *.icd
1414
cd ..
1515
for i in cmd lib strings strings/strings; do rm -f $i/*.lib $i/*.lst; done

config.std

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ SCRIPTS_PATH = ..\..\scripts
1313
!endif
1414
RMFILES = $(SCRIPTS_PATH)\rmfiles
1515

16+
FIXSTRSOPT = --lib
17+
1618
## Where the pre-compiled SUPPL files are located
1719
## See DOCS\SUPPL.TXT for more information about this library
1820
SUPPL_INC_PATH = ..$(DIRSEP)suppl

mkfiles/bc5.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ LD = $(BINPATH)\Tlink /m/s/l /c/d /i @$(LD_RSP)
1313
OBJC0 = $(LIBPATH)\c0$(SHELL_MMODEL).obj
1414
LIBC = $(LIBPATH)\c$(SHELL_MMODEL).lib
1515

16+
FIXSTRSOPT = --lib1
17+
1618
CFG = TURBOC.CFG
1719
CFLAGS1 = -1- -a -f- -ff- -K -w+ -O -Z
1820
CFLAGS2 = -b- -v -L$(LIBPATH)

mkfiles/tc2.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ LD = $(BINPATH)\Tlink /m/s/l /c/d @$(LD_RSP)
1111
OBJC0 = $(LIBPATH)\c0$(SHELL_MMODEL).obj
1212
LIBC = $(LIBPATH)\c$(SHELL_MMODEL).lib
1313

14+
FIXSTRSOPT = --lib2
15+
1416
CFG = TURBOC.CFG
1517
CFLAGS1 = -1- -a- -f- -ff- -K -w+ -O -Z
1618
CFLAGS2 = -L$(LIBPATH)

mkfiles/turbocpp.mak

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ LD = $(BINPATH)\Tlink /m/s/l /c/d @$(LD_RSP)
1313
OBJC0 = $(LIBPATH)\c0$(SHELL_MMODEL).obj
1414
LIBC = $(LIBPATH)\c$(SHELL_MMODEL).lib
1515

16+
FIXSTRSOPT = --lib2
17+
1618
CFG = TURBOC.CFG
1719
CFLAGS1 = -1- -a -f- -ff- -K -w+ -O -Z
1820
CFLAGS2 = -b- -L$(LIBPATH)

strings/fixstrs.c

Lines changed: 95 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static char *strupr(char *s)
101101
#define fEXT ".lng"
102102
#define fDMAKEFILE "makefile"
103103
#define fTCMAKEFILE "strings.rsp"
104+
#define fTCMAKFILE "strings.mak"
104105

105106
typedef enum STATE {
106107
LOOKING_FOR_START
@@ -644,6 +645,47 @@ int loadFile(const char * const fnam)
644645
return 0;
645646
}
646647

648+
static int create_make_dependency(void)
649+
{
650+
string_count_t cnt1;
651+
string_count_t maxCnt1;
652+
string_count_t cnt2;
653+
654+
strcpy(cfilename, fTCMAKFILE);
655+
if((lgf = fopen(cfile, "wt")) == NULL) {
656+
pxerror("creating ", cfile);
657+
return 101;
658+
}
659+
cnt1 = maxCnt1 = cnt2 = 0;
660+
for(cnt = 0; cnt < maxCnt; ++cnt) {
661+
if( cnt1 == 0 ) {
662+
if( cnt > 0 )
663+
fprintf(lgf, "\n");
664+
fprintf(lgf, "strings_deps%d : \\\n", maxCnt1++);
665+
cnt2 = 0;
666+
}
667+
fprintf(lgf, " " objfmt, cnt);
668+
if(++cnt1 > 127) {
669+
cnt1 = 0;
670+
}
671+
if(++cnt2 > 7 && cnt1 > 0) {
672+
fprintf(lgf, " \\\n");
673+
cnt2 = 0;
674+
}
675+
}
676+
for(cnt = 0; cnt < maxCnt1; ++cnt) {
677+
if( cnt == 0 )
678+
fprintf(lgf, "\nSTRINGS_DEPS =");
679+
fprintf(lgf, " strings_deps%d", cnt);
680+
}
681+
fflush(lgf);
682+
if(ferror(lgf)) {
683+
puts("Unspecific error writing to " fTCMAKFILE);
684+
return 104;
685+
}
686+
fclose(lgf);
687+
return 0;
688+
}
647689

648690
int main(int argc, char **argv)
649691
{
@@ -653,18 +695,42 @@ int main(int argc, char **argv)
653695
string_count_t cnt; /* current string number */
654696
string_size_t lsize;
655697
int makeLib = 0;
698+
const char *fmt;
656699

657700
unlink(logfile);
658701

659-
if(argv[1] && (stricmp(argv[1], "/lib") == 0 || stricmp(argv[1], "--lib") == 0)) {
660-
--argc;
661-
++argv;
662-
makeLib = 1;
702+
while(argv[1] != NULL ) {
703+
if(stricmp(argv[1], "/lib") == 0 || stricmp(argv[1], "--lib") == 0) {
704+
--argc;
705+
++argv;
706+
makeLib = 1;
707+
} else if(stricmp(argv[1], "/lib1") == 0 || stricmp(argv[1], "--lib1") == 0) {
708+
--argc;
709+
++argv;
710+
makeLib = 2;
711+
} else if(stricmp(argv[1], "/lib2") == 0 || stricmp(argv[1], "--lib2") == 0) {
712+
--argc;
713+
++argv;
714+
makeLib = 3;
715+
} else {
716+
break;
717+
}
663718
}
664719

665-
if(argc > 2) {
720+
/*
721+
* Hidden options lib and lib1 and lib2
722+
*
723+
* if one of these option is used then program generate strings library
724+
* source files and generate make files and response file for make utility
725+
*
726+
* lib.. options control response file format
727+
* lib2 format is '+<file name> &'
728+
* lib1 format is '+<file name>'
729+
* lib format is '<file name>' only
730+
*/
731+
if(argc > 2 ) {
666732
puts("FIXSTRS - Generate STRINGS.DAT and STRINGS.H for a language\n"
667-
"Useage: FIXSTRS [/lib] [language]\n"
733+
"Useage: FIXSTRS [/lib|/lib1|/lib2] [language]\n"
668734
"\tIf no language is specified, only the default strings are read.\n"
669735
"\tThe <language>.LNG file must reside in the current directory.\n"
670736
"Note: DEFAULT.lng must be present in the current directory, too.");
@@ -822,6 +888,8 @@ puts("FIXSTRS: building STRINGS resource");
822888
pxerror("creating ", cfile);
823889
return 100;
824890
}
891+
if((rc = create_make_dependency()) != 0)
892+
return rc;
825893
strcpy(cfilename, fTCMAKEFILE);
826894
if((ftc101 = fopen(cfile, "wt")) == NULL) {
827895
pxerror("creating ", cfile);
@@ -847,19 +915,27 @@ strings.lib .LIBRARY : ", fdmake);
847915
dumpString(cnt);
848916
fprintf(fdmake, "\\\n\t" objfmt, cnt);
849917
}
850-
for(cnt = 0; cnt < maxCnt - 1; ++cnt)
851-
#if defined(__TURBOC__)
852-
fprintf(ftc101, "+" objfmt " &\n", cnt);
853-
#elif defined(GCC)
854-
fprintf(ftc101, objfmt "\n", cnt);
855-
#else
856-
fprintf(ftc101, "+" objfmt "\n", cnt);
857-
#endif
858-
#if defined(GCC)
859-
fprintf(ftc101, objfmt " \n", cnt);
860-
#else
861-
fprintf(ftc101, "+" objfmt " \n", cnt);
862-
#endif
918+
if(makeLib == 3) {
919+
/* Turbo C */
920+
fmt = "+" objfmt " &\n";
921+
} else if(makeLib == 2) {
922+
/* Borland C */
923+
fmt = "+" objfmt "\n";
924+
} else {
925+
/* GCC, Open Watcom */
926+
fmt = objfmt "\n";
927+
}
928+
for(cnt = 0; cnt < maxCnt - 1; ++cnt) {
929+
fprintf(ftc101, fmt, cnt);
930+
}
931+
if(makeLib > 1) {
932+
/* Borland C, Turbo C */
933+
fmt = "+" objfmt "\n";
934+
} else {
935+
/* GCC, Open Watcom */
936+
fmt = objfmt "\n";
937+
}
938+
fprintf(ftc101, fmt, cnt);
863939
/********************** epilogue */
864940

865941
fputs("\n\

strings/makefile.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ TOP = ..
88
all : $(CFG) strings.h strings.err fixstrs.exe
99

1010
strings.h : DEFAULT.lng
11-
..$(DIRSEP)utilsc$(DIRSEP)fixstrs.exe --lib $(LNG)
11+
..$(DIRSEP)utilsc$(DIRSEP)fixstrs.exe $(FIXSTRSOPT) $(LNG)
1212
$(CP) strings.h ..
1313

1414
strings.err : DEFAULT.err

strings/strings/makefile.mak

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,9 @@ TOP = ../..
66

77
all : $(CFG) strings.lib
88

9-
OBJS1 = str0000.obj str0001.obj str0002.obj str0003.obj str0004.obj str0005.obj str0006.obj str0007.obj
10-
OBJS2 = str0008.obj str0009.obj str000a.obj str000b.obj str000c.obj str000d.obj str000e.obj str000f.obj
11-
OBJS3 = str0010.obj str0011.obj str0012.obj str0013.obj str0014.obj str0015.obj str0016.obj str0017.obj
12-
OBJS4 = str0018.obj str0019.obj str001a.obj str001b.obj str001c.obj str001d.obj str001e.obj str001f.obj
13-
OBJS5 = str0020.obj str0021.obj str0022.obj str0023.obj str0024.obj str0025.obj str0026.obj str0027.obj
14-
OBJS6 = str0028.obj str0029.obj str002a.obj str002b.obj str002c.obj str002d.obj str002e.obj str002f.obj
15-
OBJS7 = str0030.obj str0031.obj str0032.obj str0033.obj str0034.obj str0035.obj str0036.obj str0037.obj
16-
OBJS8 = str0038.obj str0039.obj str003a.obj str003b.obj str003c.obj str003d.obj str003e.obj str003f.obj
17-
OBJS9 = str0040.obj str0041.obj str0042.obj str0043.obj str0044.obj str0045.obj str0046.obj str0047.obj
18-
OBJS10 = str0048.obj str0049.obj str004a.obj str004b.obj str004c.obj str004d.obj str004e.obj str004f.obj
19-
OBJS11 = str0050.obj str0051.obj str0052.obj str0053.obj str0054.obj str0055.obj str0056.obj str0057.obj
20-
OBJS12 = str0058.obj str0059.obj str005a.obj str005b.obj str005c.obj str005d.obj str005e.obj str005f.obj
21-
OBJS13 = str0060.obj str0061.obj str0062.obj str0063.obj str0064.obj str0065.obj str0066.obj str0067.obj
22-
OBJS14 = str0068.obj str0069.obj str006a.obj str006b.obj str006c.obj str006d.obj str006e.obj str006f.obj
23-
OBJS15 = str0070.obj str0071.obj str0072.obj str0073.obj str0074.obj str0075.obj str0076.obj str0077.obj
24-
OBJS16 = str0078.obj str0079.obj str007a.obj str007b.obj str007c.obj str007d.obj str007e.obj str007f.obj
25-
OBJS17 = str0080.obj str0081.obj str0082.obj str0083.obj str0084.obj str0085.obj str0086.obj str0087.obj
26-
OBJS18 = str0088.obj str0089.obj str008a.obj str008b.obj str008c.obj str008d.obj str008e.obj str008f.obj
27-
OBJS19 = str0090.obj str0091.obj str0092.obj str0093.obj str0094.obj str0095.obj str0096.obj str0097.obj
28-
OBJS20 = str0098.obj str0099.obj str009a.obj str009b.obj str009c.obj str009d.obj str009e.obj str009f.obj
29-
OBJS21 = str00a0.obj str00a1.obj str00a2.obj str00a3.obj str00a4.obj str00a5.obj str00a6.obj str00a7.obj
30-
OBJS22 = str00a8.obj str00a9.obj str00aa.obj str00ab.obj str00ac.obj str00ad.obj str00ae.obj str00af.obj
31-
OBJS23 = str00b0.obj str00b1.obj str00b2.obj str00b3.obj str00b4.obj str00b5.obj str00b6.obj str00b7.obj
32-
OBJS24 = str00b8.obj str00b9.obj str00ba.obj str00bb.obj str00bc.obj str00bd.obj str00be.obj str00bf.obj
33-
OBJS25 = str00c0.obj str00c1.obj str00c2.obj str00c3.obj str00c4.obj str00c5.obj str00c6.obj str00c7.obj
34-
OBJS26 = str00c8.obj str00c9.obj str00ca.obj str00cb.obj str00cc.obj str00cd.obj str00ce.obj str00cf.obj
35-
OBJS27 = str00d0.obj str00d1.obj str00d2.obj str00d3.obj str00d4.obj str00d5.obj str00d6.obj str00d7.obj
36-
OBJS28 = str00d8.obj str00d9.obj str00da.obj str00db.obj str00dc.obj str00dd.obj str00de.obj str00df.obj
37-
OBJS29 = str00e0.obj str00e1.obj str00e2.obj str00e3.obj str00e4.obj str00e5.obj str00e6.obj str00e7.obj
38-
OBJS30 = str00e8.obj str00e9.obj str00ea.obj str00eb.obj str00ec.obj str00ed.obj str00ee.obj str00ef.obj
39-
OBJS31 = str00f0.obj str00f1.obj str00f2.obj str00f3.obj str00f4.obj str00f5.obj str00f6.obj str00f7.obj
40-
OBJS32 = str00f8.obj str00f9.obj str00fa.obj str00fb.obj str00fc.obj str00fd.obj str00fe.obj
9+
!include "strings.mak"
4110

42-
strings_deps1 : $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(OBJS7) $(OBJS8) \
43-
$(OBJS9) $(OBJS10) $(OBJS11) $(OBJS12) $(OBJS13) $(OBJS14) $(OBJS15) $(OBJS16) $(OBJS17)
44-
45-
strings_deps2 : $(OBJS18) $(OBJS19) $(OBJS20) $(OBJS21) $(OBJS22) $(OBJS23) $(OBJS24) \
46-
$(OBJS25) $(OBJS26) $(OBJS27) $(OBJS28) $(OBJS29) $(OBJS30) $(OBJS31) $(OBJS32)
47-
48-
strings.lib: ../strings.h ../strings.err strings_deps1 strings_deps2
11+
strings.lib: ../strings.h ../strings.err $(STRINGS_DEPS)
4912
echo Making STRINGS library
5013
$(RMFILES) strings.lib
5114
$(AR) strings.lib @strings.rsp $(LIBLIST) strings.lst

0 commit comments

Comments
 (0)