From: bernhardheld Date: Sat, 11 Jan 2003 01:40:30 +0000 (+0000) Subject: new option -o X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=7acf410d97f954d4aa6f2a728e2faa39b555ba13;p=fw%2Fsdcc new option -o git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2147 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/.version b/.version index f90b1afc..0bee604d 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.3.2 +2.3.3 diff --git a/ChangeLog b/ChangeLog index 0b3ddc7d..877ab712 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2003-01-11 Bernhard Held + + * .version: Bumped version number to 2.3.3 + * src/SDCCBBlock.c: new option -o + * src/SDCCglobl.h: new option -o + * src/SDCCglue.c: new option -o + * src/SDCCmain.c: new option -o + * src/asm.c: new option -o + * src/ds390/main.c: new option -o + * src/pic/glue.c: new option -o + * src/pic/pcode.c: new option -o + * src/pic/ralloc.c: new option -o + * src/pic16/glue.c: new option -o + * src/pic16/pcode.c: new option -o + * src/pic16/ralloc.c: new option -o + * src/z80/main.c: new option -o + * device/lib/Makefile.in: use -o + * support/regression/ports/ds390/spec.mk: use -o + * support/regression/ports/gbz80/spec.mk: use -o + * support/regression/ports/mcs51/spec.mk: use -o + * support/regression/ports/mcs51-stack-auto/spec.mk: use -o + * support/regression/ports/z80/spec.mk: use -o + * support/regression/ports/ucz80/spec.mk: use -o + * support/regression/ports/xa51/spec.mk: use -o + * support/regression/fwk/lib/timeout.c: fix usage string + 2003-01-09 Bernhard Held * src/mcs51/gen.c (genPlus): replaced "mov b,acc" by "mov b,a" Fiorenzo D. Ramaglia diff --git a/device/lib/Makefile.in b/device/lib/Makefile.in index 572ff51a..b4b868ef 100644 --- a/device/lib/Makefile.in +++ b/device/lib/Makefile.in @@ -233,9 +233,7 @@ include clean.mk .SUFFIXES: .rel .o $(PORTDIR)/%$(OEXT): %.c - $(CC) $(CPPFLAGS) $(CFLAGS) -c $< - mv -f `basename $@` $@ - mv -f `basename $@ $(OEXT)`.asm $(PORTDIR) + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ # Remaking configuration # ---------------------- diff --git a/src/SDCCBBlock.c b/src/SDCCBBlock.c index a656fb77..2d879cef 100644 --- a/src/SDCCBBlock.c +++ b/src/SDCCBBlock.c @@ -102,7 +102,7 @@ FILE *appendDumpFile (int id) { if (!dumpFilesPtr->filePtr) { // not used before, create it - strcpy (scratchFileName, srcFileName); + strcpy (scratchFileName, dstFileName); strcat (scratchFileName, dumpFilesPtr->ext); if (!(dumpFilesPtr->filePtr = fopen (scratchFileName, "w"))) { werror (E_FILE_OPEN_ERR, scratchFileName); diff --git a/src/SDCCglobl.h b/src/SDCCglobl.h index 1a62ccc4..b705b5d7 100644 --- a/src/SDCCglobl.h +++ b/src/SDCCglobl.h @@ -53,7 +53,6 @@ #define PATH_MAX 255 /* define a reasonable value */ #endif -#define MAX_FNAME_LEN 128 #define MAX_REG_PARMS 1 typedef int bool; @@ -260,8 +259,15 @@ struct options extern int noAssemble; /* no assembly, stop after code generation */ extern char *yytext; extern char *currFname; -extern char *srcFileName; /* source file name without the extenstion */ -extern char *moduleName; /* source file name without path & extension */ +extern char *fullSrcFileName; /* full name for the source file; */ + /* can be NULL while linking without compiling */ +extern char *fullDstFileName; /* full name for the output file; */ + /* only given by -o, otherwise NULL */ +extern char *dstFileName; /* destination file name without extension */ +extern char *dstPath; /* path for the output files; */ + /* "" is equivalent with cwd */ +extern char *moduleName; /* module name is source file without path and extension */ + /* can be NULL while linking without compiling */ extern int currLineno; /* current line number */ extern int yylineno; /* line number of the current file SDCC.lex */ extern FILE *yyin; /* */ diff --git a/src/SDCCglue.c b/src/SDCCglue.c index 45d37422..75c40870 100644 --- a/src/SDCCglue.c +++ b/src/SDCCglue.c @@ -1460,8 +1460,16 @@ glue (void) if (!options.c1mode) { - sprintf (scratchFileName, srcFileName); + /* -o option overrides default name? */ + if (noAssemble && fullDstFileName) + { + strcpy (scratchFileName, fullDstFileName); + } + else + { + strcpy (scratchFileName, dstFileName); strcat (scratchFileName, port->assembler.file_ext); + } } else { diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 5c3e0e27..19e9e7cf 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -51,9 +51,15 @@ extern int yyparse (); FILE *srcFile; /* source file */ FILE *cdbFile = NULL; /* debugger information output file */ -char *fullSrcFileName; /* full name for the source file */ -char *srcFileName; /* source file name with the .c stripped */ -char *moduleName; /* module name is srcFilename stripped of any path */ +char *fullSrcFileName; /* full name for the source file; */ + /* can be NULL while linking without compiling */ +char *fullDstFileName; /* full name for the output file; */ + /* only given by -o, otherwise NULL */ +char *dstFileName; /* destination file name without extension */ +char *dstPath = ""; /* path for the output files; */ + /* "" is equivalent with cwd */ +char *moduleName; /* module name is source file without path and extension */ + /* can be NULL while linking without compiling */ const char *preArgv[128]; /* pre-processor arguments */ int currRegBank = 0; int RegBankUsed[4]={1, 0, 0, 0}; /*JCF: Reg Bank 0 used by default*/ @@ -150,6 +156,7 @@ optionsTable[] = { { 0, "--nojtbound", &optimize.noJTabBoundary, "Don't generate boundary check for jump tables" }, { 0, "--noloopreverse", &optimize.noLoopReverse, "Disable the loop reverse optimisation" }, { 'c', "--compile-only", &options.cc_only, "Compile and assemble, but do not link" }, + { 'o', NULL, NULL, "Place the output into the given path resp. file" }, { 0, "--dumpraw", &options.dump_raw, "Dump the internal structure after the initial parse" }, { 0, "--dumpgcse", &options.dump_gcse, NULL }, { 0, "--dumploop", &options.dump_loop, NULL }, @@ -535,7 +542,7 @@ processFile (char *s) { /* source file name : not if we already have a source file */ - if (srcFileName) + if (fullSrcFileName) { werror (W_TOO_MANY_SRC, s); return; @@ -554,28 +561,35 @@ processFile (char *s) /* get rid of the "."-extension */ /* is there a dot at all? */ - if (strchr (buffer, '.') && + if (strrchr (buffer, '.') && /* is the dot in the filename, not in the path? */ - (strrchr (buffer, '/' ) < strrchr (buffer, '.') || - strrchr (buffer, '\\') < strrchr (buffer, '.'))) + (strrchr (buffer, DIR_SEPARATOR_CHAR) < strrchr (buffer, '.'))) + { *strrchr (buffer, '.') = '\0'; - - srcFileName = Safe_alloc ( strlen (buffer) + 1); - strcpy (srcFileName, buffer); + } /* get rid of any path information - for the module name; do this by going - backwards till we get to either '/' or '\' or ':' - or start of buffer */ + for the module name; */ fext = buffer + strlen (buffer); +#if NATIVE_WIN32 + /* do this by going backwards till we + get '\' or ':' or start of buffer */ while (fext != buffer && - *(fext - 1) != '\\' && - *(fext - 1) != '/' && + *(fext - 1) != DIR_SEPARATOR_CHAR && *(fext - 1) != ':') + { fext--; - moduleName = Safe_alloc ( strlen (fext) + 1); - strcpy (moduleName, fext); - + } +#else + /* do this by going backwards till we + get '/' or start of buffer */ + while (fext != buffer && + *(fext - 1) != DIR_SEPARATOR_CHAR) + { + fext--; + } +#endif + moduleName = Safe_strdup ( fext ); return; } @@ -603,7 +617,7 @@ processFile (char *s) static void _processC1Arg (char *s) { - if (srcFileName) + if (fullSrcFileName) { if (options.out_name) { @@ -784,7 +798,7 @@ tryHandleSimpleOpt(char **argv, int *pi) /*-----------------------------------------------------------------*/ /* parseCmdLine - parses the command line and sets the options */ /*-----------------------------------------------------------------*/ -int +static int parseCmdLine (int argc, char **argv) { int i; @@ -1010,6 +1024,46 @@ parseCmdLine (int argc, char **argv) case 'l': libFiles[nlibFiles++] = getStringArg("-l", argv, &i, argc); break; + + case 'o': + { + char *p; + + /* copy the file name into the buffer */ + strcpy (buffer, getStringArg("-o", argv, &i, argc)); + /* point to last character */ + p = buffer + strlen (buffer) - 1; + if (*p == DIR_SEPARATOR_CHAR) + { + /* only output path specified */ + dstPath = Safe_strdup (buffer); + fullDstFileName = NULL; + } + else + { + fullDstFileName = Safe_strdup (buffer); + + /* get rid of the "."-extension */ + + /* is there a dot at all? */ + if (strrchr (buffer, '.') && + /* is the dot in the filename, not in the path? */ + (strrchr (buffer, DIR_SEPARATOR_CHAR) < strrchr (buffer, '.'))) + *strrchr (buffer, '.') = '\0'; + + dstFileName = Safe_strdup (buffer); + + /* strip module name to get path */ + p = strrchr (buffer, DIR_SEPARATOR_CHAR); + if (p) + { + /* path with trailing / */ + p[1] = '\0'; + dstPath = Safe_strdup (buffer); + } + } + break; + } case 'W': /* pre-processer options */ @@ -1103,14 +1157,49 @@ parseCmdLine (int argc, char **argv) } } + /* if no dstFileName given with -o, we've to find one: */ + if (!dstFileName) + { + /* use the modulename from the C-source */ + if (fullSrcFileName) + { + dstFileName = Safe_alloc (strlen (dstPath) + strlen (moduleName) + 1); + strcpy (dstFileName, dstPath); + strcat (dstFileName, moduleName); + } + /* use the modulename from the first object file */ + else if (nrelFiles >= 1) + { + char *objectName; + + strcpy (buffer, relFiles[0]); + /* remove extension (it must be .rel) */ + *strrchr (buffer, '.') = '\0'; + /* remove path */ + objectName = strrchr (buffer, DIR_SEPARATOR_CHAR); + if (objectName) + { + ++objectName; + } + else + { + objectName = buffer; + } + dstFileName = Safe_alloc (strlen (dstPath) + strlen (objectName) + 1); + strcpy (dstFileName, dstPath); + strcat (dstFileName, objectName); + } + /* else no module given: help text is displayed */ + } + /* set up external stack location if not explicitly specified */ if (!options.xstack_loc) options.xstack_loc = options.xdata_loc; /* if debug option is set the open the cdbFile */ - if (options.debug && srcFileName) + if (options.debug && fullSrcFileName) { - sprintf (scratchFileName, "%s.adb", srcFileName); //JCF: Nov 30, 2002 + sprintf (scratchFileName, "%s.adb", dstFileName); //JCF: Nov 30, 2002 if ((cdbFile = fopen (scratchFileName, "w")) == NULL) werror (E_FILE_OPEN_ERR, scratchFileName); else @@ -1130,13 +1219,10 @@ linkEdit (char **envp) { FILE *lnkfile; char *segName, *c; - int i; - if (!srcFileName) - srcFileName = "temp"; /* first we need to create the .lnk file */ - sprintf (scratchFileName, "%s.lnk", srcFileName); + sprintf (scratchFileName, "%s.lnk", dstFileName); if (!(lnkfile = fopen (scratchFileName, "w"))) { werror (E_FILE_OPEN_ERR, scratchFileName); @@ -1243,8 +1329,8 @@ linkEdit (char **envp) fprintf (lnkfile, "-l %s\n", libFiles[i]); /* put in the object files */ - if (strcmp (srcFileName, "temp")) - fprintf (lnkfile, "%s ", srcFileName); + if (fullSrcFileName) + fprintf (lnkfile, "%s ", dstFileName); for (i = 0; i < nrelFiles; i++) fprintf (lnkfile, "%s\n", relFiles[i]); @@ -1258,7 +1344,7 @@ linkEdit (char **envp) if (port->linker.cmd) { char buffer2[PATH_MAX]; - buildCmdLine (buffer2, port->linker.cmd, srcFileName, NULL, NULL, NULL); + buildCmdLine (buffer2, port->linker.cmd, dstFileName, NULL, NULL, NULL); buildCmdLine2 (buffer, buffer2); } else @@ -1270,14 +1356,22 @@ linkEdit (char **envp) { exit (1); } - - if (strcmp (srcFileName, "temp") == 0) + /* -o option overrides default name? */ + if (fullDstFileName) + { + /* the linked file gets the name of the first modul */ + if (fullSrcFileName) { - /* rename "temp.cdb" to "firstRelFile.cdb" */ - char *f = strtok (Safe_strdup (relFiles[0]), "."); - f = strcat (f, ".cdb"); - rename ("temp.cdb", f); - srcFileName = NULL; + strcpy (scratchFileName, dstFileName); + } + else + { + strcpy (scratchFileName, relFiles[0]); + /* strip ".rel" extension */ + *strrchr (scratchFileName, '.') = '\0'; + } + strcat (scratchFileName, options.out_fmt ? ".S19" : ".ihx"); + rename (scratchFileName, fullDstFileName); } } @@ -1291,7 +1385,7 @@ assemble (char **envp) port->assembler.do_assemble(asmOptions); return ; } else if (port->assembler.cmd) { - buildCmdLine (buffer, port->assembler.cmd, srcFileName, NULL, + buildCmdLine (buffer, port->assembler.cmd, dstFileName, NULL, options.debug ? port->assembler.debug_opts : port->assembler.plain_opts, asmOptions); } else { @@ -1304,6 +1398,12 @@ assemble (char **envp) */ exit (1); } + /* -o option overrides default name? */ + if (options.cc_only && fullDstFileName) { + strcpy (scratchFileName, dstFileName); + strcat (scratchFileName, ".rel"); + rename (scratchFileName, fullDstFileName); + } } /*-----------------------------------------------------------------*/ @@ -1549,8 +1649,28 @@ initValues (void) setMainValue ("objext", port->linker.rel_ext); setMainValue ("asmext", port->assembler.file_ext); + setMainValue ("dstfilename", dstFileName); setMainValue ("fullsrcfilename", fullSrcFileName ? fullSrcFileName : "fullsrcfilename"); - setMainValue ("srcfilename", srcFileName ? srcFileName : "srcfilename"); + + if (options.cc_only && fullDstFileName) + /* compile + assemble and -o given: -o specifies name of object file */ + { + setMainValue ("z80objdstfilename", fullDstFileName); + } + else + { + setMainValue ("z80objdstfilename", "{z80stdobjdstfilename}"); + } + if (fullDstFileName) + /* if we're linking, -o gives the final file name */ + { + setMainValue ("z80linkdstfilename", fullDstFileName); + } + else + { + setMainValue ("z80linkdstfilename", "{z80stdlinkdstfilename}"); + } + } /* @@ -1609,8 +1729,8 @@ main (int argc, char **argv, char **envp) parseCmdLine (argc, argv); /* if no input then printUsage & exit */ - if ((!options.c1mode && !srcFileName && !nrelFiles) || - (options.c1mode && !srcFileName && !options.out_name)) + if ((!options.c1mode && !fullSrcFileName && !nrelFiles) || + (options.c1mode && !fullSrcFileName && !options.out_name)) { printUsage (); exit (0); @@ -1619,7 +1739,7 @@ main (int argc, char **argv, char **envp) initValues (); _discoverPaths (argv[0]); - if (srcFileName) + if (fullSrcFileName) { initMem (); @@ -1690,7 +1810,7 @@ main (int argc, char **argv, char **envp) !fatalError && !noAssemble && !options.c1mode && - (srcFileName || nrelFiles)) + (fullSrcFileName || nrelFiles)) { if (port->linker.do_link) port->linker.do_link (); diff --git a/src/asm.c b/src/asm.c index e1da9063..8b9f7798 100644 --- a/src/asm.c +++ b/src/asm.c @@ -130,7 +130,7 @@ tvsprintf (char *buffer, const char *format, va_list ap) break; case 'F': // Source file name. - pInto = _appendAt (pInto, newFormat, srcFileName); + pInto = _appendAt (pInto, newFormat, fullSrcFileName); sz++; break; case 'N': diff --git a/src/ds390/main.c b/src/ds390/main.c index f6fdd4e0..a52127d9 100644 --- a/src/ds390/main.c +++ b/src/ds390/main.c @@ -516,11 +516,11 @@ static void _tininative_do_assemble (const char * const *asmOptions) }; char buffer[100]; - buildCmdLine(buffer,macroCmd,srcFileName,NULL,NULL,NULL); + buildCmdLine(buffer,macroCmd,dstFileName,NULL,NULL,NULL); if (my_system(buffer)) { exit(1); } - buildCmdLine(buffer,a390Cmd,srcFileName,NULL,NULL,asmOptions); + buildCmdLine(buffer,a390Cmd,dstFileName,NULL,NULL,asmOptions); if (my_system(buffer)) { exit(1); } diff --git a/src/pic/glue.c b/src/pic/glue.c index e0f73fb7..160f8bde 100644 --- a/src/pic/glue.c +++ b/src/pic/glue.c @@ -808,8 +808,15 @@ picglue () /* create the assembler file name */ if (!options.c1mode) { - sprintf (buffer, srcFileName); - strcat (buffer, ".asm"); + if (noAssemble && fullDstFileName) + { + sprintf (buffer, fullDstFileName); + } + else + { + sprintf (buffer, dstFileName); + strcat (buffer, ".asm"); + } } else { strcpy(buffer, options.out_name); diff --git a/src/pic/pcode.c b/src/pic/pcode.c index 28a806f2..b9d3418c 100644 --- a/src/pic/pcode.c +++ b/src/pic/pcode.c @@ -1587,7 +1587,7 @@ void pcode_test(void) char buffer[100]; /* create the file name */ - strcpy(buffer,srcFileName); + strcpy(buffer,dstFileName); strcat(buffer,".p"); if( !(pFile = fopen(buffer, "w" ))) { diff --git a/src/pic/ralloc.c b/src/pic/ralloc.c index a8599cd7..d4ab0afc 100644 --- a/src/pic/ralloc.c +++ b/src/pic/ralloc.c @@ -102,14 +102,14 @@ debugLog (char *fmt,...) //char *bufferP=buffer; va_list ap; - if (!debug || !srcFileName) + if (!debug || !dstFileName) return; if (!debugF) { /* create the file name */ - strcpy (buffer, srcFileName); + strcpy (buffer, dstFileName); strcat (buffer, ".d"); if (!(debugF = fopen (buffer, (append ? "a+" : "w")))) diff --git a/src/pic16/glue.c b/src/pic16/glue.c index 9c79d34a..6b601ce4 100644 --- a/src/pic16/glue.c +++ b/src/pic16/glue.c @@ -808,9 +808,16 @@ pic16glue () /* create the assembler file name */ if (!options.c1mode) { - sprintf (buffer, srcFileName); + if (noAssemble && fullDstFileName) + { + sprintf (buffer, fullDstFileName); + } + else + { + sprintf (buffer, dstFileName); strcat (buffer, ".asm"); } + } else { strcpy(buffer, options.out_name); } diff --git a/src/pic16/pcode.c b/src/pic16/pcode.c index 12fed716..b0a6645a 100644 --- a/src/pic16/pcode.c +++ b/src/pic16/pcode.c @@ -2644,7 +2644,7 @@ void pic16_pcode_test(void) char buffer[100]; /* create the file name */ - strcpy(buffer,srcFileName); + strcpy(buffer,dstFileName); strcat(buffer,".p"); if( !(pFile = fopen(buffer, "w" ))) { diff --git a/src/pic16/ralloc.c b/src/pic16/ralloc.c index 638647fe..60c2a884 100644 --- a/src/pic16/ralloc.c +++ b/src/pic16/ralloc.c @@ -104,14 +104,14 @@ debugLog (char *fmt,...) //char *bufferP=buffer; va_list ap; - if (!debug || !srcFileName) + if (!debug || !dstFileName) return; if (!debugF) { /* create the file name */ - strcpy (buffer, srcFileName); + strcpy (buffer, dstFileName); strcat (buffer, ".d"); if (!(debugF = fopen (buffer, (append ? "a+" : "w")))) diff --git a/src/z80/main.c b/src/z80/main.c index 5389b50c..eafbd655 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -187,15 +187,10 @@ static void _gbz80_rgblink (void) { FILE *lnkfile; - const char *sz; - int i; - sz = srcFileName; - if (!sz) - sz = "a"; /* first we need to create the .lnk file */ - sprintf (scratchFileName, "%s.lnk", sz); + sprintf (scratchFileName, "%s.lnk", dstFileName); if (!(lnkfile = fopen (scratchFileName, "w"))) { werror (E_FILE_OPEN_ERR, scratchFileName); @@ -204,8 +199,7 @@ _gbz80_rgblink (void) fprintf (lnkfile, "[Objects]\n"); - if (srcFileName) - fprintf (lnkfile, "%s.o\n", sz); + fprintf (lnkfile, "%s.o\n", dstFileName); for (i = 0; i < nrelFiles; i++) fprintf (lnkfile, "%s\n", relFiles[i]); @@ -216,11 +210,11 @@ _gbz80_rgblink (void) fprintf (lnkfile, "%s\n", libFiles[i]); - fprintf (lnkfile, "\n[Output]\n" "%s.gb", sz); + fprintf (lnkfile, "\n[Output]\n" "%s.gb", dstFileName); fclose (lnkfile); - buildCmdLine (buffer,port->linker.cmd, sz, NULL, NULL, NULL); + buildCmdLine (buffer,port->linker.cmd, dstFileName, NULL, NULL, NULL); /* call the linker */ if (my_system (buffer)) { @@ -316,6 +310,9 @@ _setValues(void) setMainValue ("z80outext", ".ihx"); } + setMainValue ("z80stdobjdstfilename" , "{dstfilename}{objext}"); + setMainValue ("z80stdlinkdstfilename", "{dstfilename}{z80outext}"); + setMainValue ("z80extraobj", joinn (relFiles, nrelFiles)); sprintf (buffer, "-b_CODE=0x%04X -b_DATA=0x%04X", options.code_loc, options.data_loc); @@ -447,13 +444,13 @@ _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right) "{bindir}{sep}link-{port} -n -c -- {z80bases} -m -j" \ " {z80libspec}" \ " {z80extralibfiles} {z80extralibpaths}" \ - " {z80outputtypeflag} {srcfilename}{z80outext}" \ + " {z80outputtypeflag} {z80linkdstfilename}" \ " {z80crt0}" \ - " {srcfilename}{objext}" \ + " {dstfilename}{objext}" \ " {z80extraobj}" #define ASMCMD \ - "{bindir}{sep}as-{port} -plosgff {srcfilename}{objext} {srcfilename}{asmext}" + "{bindir}{sep}as-{port} -plosgff {z80objdstfilename} {dstfilename}{asmext}" /* Globals */ PORT z80_port = diff --git a/support/regression/fwk/lib/timeout.c b/support/regression/fwk/lib/timeout.c index 4e076f3d..899d247c 100644 --- a/support/regression/fwk/lib/timeout.c +++ b/support/regression/fwk/lib/timeout.c @@ -26,10 +26,10 @@ #define USAGE PROGNAME " : 1.00\n" \ "Usage : " PROGNAME " timeout_in_seconds filename [arguments]\n" \ - " ´filename´ is executed, the arguments are passed to ´filename´.\n" \ - " When ´filename´exits before the timeout expires, the\n" \ - " exit-status of ´filename´ is returned.\n" \ - " When the timeout expires before ´filename´ exits, ´filename´\n" \ + " \"filename\" is executed, the arguments are passed to \"filename\".\n" \ + " When \"filename\" exits before the timeout expires, the\n" \ + " exit-status of \"filename\" is returned.\n" \ + " When the timeout expires before \"filename\" exits, \"filename\"\n" \ " will be killed and an exit-status of 1 is returned.\n" /* First the program tries to limit the maximum CPU-time to the timeout-value. @@ -163,3 +163,4 @@ main (int argc, char * const *argv) } } } + diff --git a/support/regression/ports/ds390/spec.mk b/support/regression/ports/ds390/spec.mk index 1ff106bd..81f87942 100644 --- a/support/regression/ports/ds390/spec.mk +++ b/support/regression/ports/ds390/spec.mk @@ -15,18 +15,16 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT) # Rule to link into .ihx %$(EXEEXT): %$(OBJEXT) $(EXTRAS) - $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< - mv fwk/lib/testfwk.ihx $@ - mv fwk/lib/testfwk.map $(@:.ihx=.map) + $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@ %$(OBJEXT): %.c - $(SDCC) $(SDCCFLAGS) -c $< + $(SDCC) $(SDCCFLAGS) -c $< -o $@ # run simulator with 10 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout mkdir -p `dirname $@` -fwk/lib/timeout 10 $(S51) -tds390f -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/ds390/uCsim.cmd >/dev/null || \ - echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ -grep -n FAIL $@ /dev/null || true fwk/lib/timeout: fwk/lib/timeout.c diff --git a/support/regression/ports/gbz80/spec.mk b/support/regression/ports/gbz80/spec.mk index ae15c736..69fc47cc 100644 --- a/support/regression/ports/gbz80/spec.mk +++ b/support/regression/ports/gbz80/spec.mk @@ -11,7 +11,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) # Rule to link into .ihx %.gb: %.c $(EXTRAS) - $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) + $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -o $@ %$(OBJEXT): %.asm ../../bin/as-gbz80 -plosgff $@ $< @@ -20,7 +20,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) ../../bin/as-gbz80 -plosgff $@ $< %$(OBJEXT): %.c - $(SDCC) $(SDCCFLAGS) -c $< + $(SDCC) $(SDCCFLAGS) -c $< -o $@ # PENDING: Path to sdcc-extra %.out: %$(EXEEXT) diff --git a/support/regression/ports/mcs51-stack-auto/spec.mk b/support/regression/ports/mcs51-stack-auto/spec.mk index 51b724f9..855aef42 100644 --- a/support/regression/ports/mcs51-stack-auto/spec.mk +++ b/support/regression/ports/mcs51-stack-auto/spec.mk @@ -43,10 +43,7 @@ $(LIBDIR): mkdir -p $(LIBDIR) $(LIBDIR)/%.rel: $(LIBSRCDIR)/%.c - -$(SDCC) -I../../device/include $(LIBSDCCFLAGS) -c $< \ - && mv -f $(<:.c=.rel) $@ \ - && mv -f $(<:.c=.asm) $(@:.rel=.asm) \ - && mv -f $(<:.c=.lst) $(@:.rel=.lst) + -$(SDCC) -I../../device/include $(LIBSDCCFLAGS) -c $< -o $@ lib-files: cp $(LIBSRCDIR)/*.lib $(LIBDIR) diff --git a/support/regression/ports/mcs51/spec.mk b/support/regression/ports/mcs51/spec.mk index d2d05045..ba313c3c 100644 --- a/support/regression/ports/mcs51/spec.mk +++ b/support/regression/ports/mcs51/spec.mk @@ -17,18 +17,16 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT) # Rule to link into .ihx %$(EXEEXT): %$(OBJEXT) $(EXTRAS) - $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< - mv fwk/lib/testfwk.ihx $@ - mv fwk/lib/testfwk.map $(@:.ihx=.map) + $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@ %$(OBJEXT): %.c - $(SDCC) $(SDCCFLAGS) -c $< + $(SDCC) $(SDCCFLAGS) -c $< -o $@ # run simulator with 10 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout mkdir -p `dirname $@` -fwk/lib/timeout 10 $(S51) -t32 -S in=/dev/null,out=$@ $< < $(PORTS_DIR)/mcs51/uCsim.cmd >/dev/null \ - || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ -grep -n FAIL $@ /dev/null || true fwk/lib/timeout: fwk/lib/timeout.c diff --git a/support/regression/ports/ucz80/spec.mk b/support/regression/ports/ucz80/spec.mk index 7a9c5728..3543fb14 100644 --- a/support/regression/ports/ucz80/spec.mk +++ b/support/regression/ports/ucz80/spec.mk @@ -17,26 +17,24 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT) #%$(EXEEXT): %$(OBJEXT) $(EXTRAS) %$(EXEEXT): %.c $(EXTRAS) - $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -# mv fwk/lib/testfwk.ihx $@ -# mv fwk/lib/testfwk.map $(@:.ihx=.map) + $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -o $@ %$(OBJEXT): %.asm $(SDCC_DIR)/bin/as-z80 -plosgff $@ $< %$(OBJEXT): %.c - $(SDCC) $(SDCCFLAGS) -c $< + $(SDCC) $(SDCCFLAGS) -c $< -o $@ # run simulator with 10 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout mkdir -p `dirname $@` -fwk/lib/timeout 10 $(UCZ80) -t32 $< < $(PORTS_DIR)/$(PORT)/uCsim.cmd > $@ \ - || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@ + || echo -e --- FAIL: \"timeout, simulation killed\" in $(<:$(EXEEXT)=.c)"\n"--- Summary: 1/1/1: timeout >> $@ -grep -n FAIL $@ /dev/null || true fwk/lib/timeout: fwk/lib/timeout.c _clean: rm -f fwk/lib/timeout fwk/lib/timeout.exe $(PORTS_DIR)/$(PORT)/*.rel $(PORTS_DIR)/$(PORT)/*.rst \ - $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym $(PORTS_DIR)/$(PORT)/*.asm temp.lnk + $(PORTS_DIR)/$(PORT)/*.lst $(PORTS_DIR)/$(PORT)/*.sym temp.lnk diff --git a/support/regression/ports/xa51/spec.mk b/support/regression/ports/xa51/spec.mk index 27137dde..391c8f12 100755 --- a/support/regression/ports/xa51/spec.mk +++ b/support/regression/ports/xa51/spec.mk @@ -15,12 +15,12 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) $(PORTS_DIR)/$(PORT)/support$(OBJEXT) # Rule to link into .hex %$(EXEEXT): %$(OBJEXT) $(EXTRAS) - $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< + $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< -o $@ mv fwk/lib/testfwk.hex $@ mv fwk/lib/testfwk.map $(@:.hex=.map) %$(OBJEXT): %.c - $(SDCC) $(SDCCFLAGS) -c $< + $(SDCC) $(SDCCFLAGS) -c $< -o $@ # run simulator with 10 seconds timeout %.out: %$(EXEEXT) fwk/lib/timeout diff --git a/support/regression/ports/z80/spec.mk b/support/regression/ports/z80/spec.mk index 312af767..51001c33 100644 --- a/support/regression/ports/z80/spec.mk +++ b/support/regression/ports/z80/spec.mk @@ -16,7 +16,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) # Rule to link into .ihx %.ihx: %.c $(EXTRAS) - $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) + $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) -o $@ %$(OBJEXT): %.asm $(SDCC_DIR)/bin/as-z80 -plosgff $@ $< @@ -28,7 +28,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) $(SDCC) $(SDCCFLAGS) -c $< fwk/lib/testfwk$(OBJEXT): fwk/lib/testfwk.c - $(SDCC) $(SDCCFLAGS) -c $< + $(SDCC) $(SDCCFLAGS) -c $< -o $@ # PENDING: Path to sdcc-extra %.out: %$(EXEEXT)