#143 Fix the broken support for --program-[pre][suf]fix

Ben Shi

This patch enables the use of --program-prefix, --program-suffix, and --program-transform-name.
It was tested with a simple test program. It currently seems to have problems with pic, pic16 and z80 ports, but seems to be working with the others.
I initially developed it for mcs51, and extended it to the other ports. I intend to check the issues with pic and z80 ports later, if needed.
This patch is relative to the snapshot 20090817-5492.
I did the modifications only for systems using makefile.in stuff, for Windows projects there is more work to do - feasible, though, I guess.

To use this patch, once applied, I have to do:
configure (with the processors you want) (using --program-prefix also, if needed)
make install
make sdcc-device-lib
make install

If no program [pre][suf]fix is configured, then it should work like previously.


  • Raphael Neider

    Raphael Neider - 2009-08-21

    Could you please elaborate on the problems with pic/pic16/z80 targets?

    Looking at the patch, I see that you apply the program-transformation to the assemblers and linkers to use as well. Though this seems to be reasonable for the sdcc-supplied tools (asx8051, aslink, as-z80, link-z80, as-gbz80, link-gbz80, as-hc08, link-hc08), that are also affected by the --program-transform= argument, that approach must fail for the pic/pic16 targets that use externally supplied assemblers and linkers (gputils' gpasm and gplink), whose names are not subject to sdcc's transformation. If required, one can use the --asm="" and --link="" options to override the names of the tools -- at least for the pic16 target.

    Unless I overlooked something, I'd recommend removing the hunks in src/pic and src/pic16 before accepting this patch. The rest looks fine to me, though I did not test it.

    Thank you for the contribution.


  • hjourdain

    hjourdain - 2009-08-21

    From your explanation, I now understand that these changes are not quite well suited to the pic/pic16 targets, because they try to modify the name of the asm and link. If I understand well, these are external for pic/pic16, which I just didn't know...
    Sorry for that, but I never used pic/pic16 before, and as I told, I extended from mcs51...
    For z80, I have a problem with the "command line" part it seems... I didn't have time enough yet to solve it, as I'm going on holiday. I should be able to give it another shot in 2 weeks, if that's necessary.
    Or anyone else should be able to correct this, as I have a feeling it's just a small thing.

    Please advise me for the next steps you want me to take, if any.

    And yes, I totally agree with you about removing the hunks in src/pic*


  • hjourdain

    hjourdain - 2009-09-03

    I've reworked the patch, removed the pic modifications, and fixed the z80 support, as there was a typo in the previous one preventing it to work correctly.
    It's still for Linux systems, as I patched Makefile.in, so I guess it might be broken under Windows unless someone - me or any other person - modifies VC-related files. Is there anything specific to know about these - I'm not quite familiar with VC?

  • hjourdain

    hjourdain - 2009-09-03

    Version of the patch that leaves pic alone, and works for z80

  • hjourdain

    hjourdain - 2009-09-04

    This is a new version of the patch, that solves a copy/paste problem that caused not to strip link-hc08.
    It also - and most importantly - improves the generation process: now, just doing make, make install is enough even when using --program-prefix.

    Known issues:
    1 - pic16 device library generation doesn't work when --program-[pre][suf]fix is used, because CC is hard-coded in configure.ac, and I couldn't find yet a good way to workaround that.
    2 - There are still no Windows modifications, so I'm not sure whether it compiles with VC6

    Anyone's advice is welcome.

  • hjourdain

    hjourdain - 2009-09-04

    This version of the patch works with "make; make install"

  • Borut Ražem

    Borut Ražem - 2010-07-25

    Unfortunately the sdcc directory structure has changed in the mean time: as directory was renamed to sdas. I tried to replace as to sdas in the patch file, but I get a lot of parch errors.

    Would it be possible to recreate the patch for the latest svn revision?

    I also noticed that "transform = @program_transform_name@" is not included in all Makefiles, which is probably a problem if make is executed on the lower level.

    There are also missing double quotes in src/z80/main.c:
    __ASM_NAME__-{port} -plosgff \"{objdstfilename}\" \"{dstfilename}{asmext}\""
    should be
    __ASM_NAME__"-{port} -plosgff \"{objdstfilename}\" \"{dstfilename}{asmext}\""

    but I would rather not define the assembler / linker absolute path anyway, so that the user can define it's location with settig the PATH env. variable. So src/*/main.c files should not be patched.


  • Maarten Brock

    Maarten Brock - 2015-11-09

    In the meantime (march/april 2015) --program-prefix and --program-suffix were implemented by Ben Shi and should be working since [r9209].



    Commit: [r9209]

  • Maarten Brock

    Maarten Brock - 2015-11-09
    • status: open --> closed-out-of-date
    • assigned_to: Ben Shi
    • Group: -->

Log in to post a comment.