Menu

#33 Some makefile changes

None
fixed
None
2015-01-02
2012-10-21
Jordan
No

Looking at the generated makefile I saw some inconsistencies that are easily addressable.
The rule for "all" uses the file name instead of $(BIN). This can be addressed at line 286 of compiler.pas (as of 5.3.0.2 RC1)

Writeln(F, 'all: all-before ' + GenMakePath1(ExtractRelativePath(Makefile, fProject.Executable)) + ' all-after');

becoming

Writeln(F, 'all: all-before $(BIN) all-after');

The same should be done for the rule to build the binary.
currently it looks like

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "bin\Executor.exe" $(LIBS)

when it should look like

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o "$(BIN)" $(LIBS)

Simple fix to compiler.pas 453-456

if fProject.Options.useGPP then
    writeln(F, #9 + '$(CPP) $(LINKOBJ) -o "' + ExtractRelativePath(Makefile, fProject.Executable) + '" $(LIBS)')
else
    writeln(F, #9 + '$(CC) $(LINKOBJ) -o "' + ExtractRelativePath(Makefile, fProject.Executable) + '" $(LIBS)');

becoming

if fProject.Options.useGPP then
    writeln(F, #9 + '$(CPP) $(LINKOBJ) -o "$(BIN)" $(LIBS)')
else
    writeln(F, #9 + '$(CC) $(LINKOBJ) -o "$(BIN)" $(LIBS)');

Discussion

  • orwelldevcpp

    orwelldevcpp - 2012-10-21

    That surely looks interesting.

    The only minor thing I'm worried about is that $BIN might not always be defined properly, but I can't yet see why it shouldn't. But if BIN is always set properly, this will be quite a nice fix (mainly because it nicely simplifies the source code).

    This update will find its way into 5.3.0.2 if all goes well. Expect that version in the coming few days.

     
  • orwelldevcpp

    orwelldevcpp - 2012-10-21
    • status: open --> accepted
    • assigned_to: orwelldevcpp
    • milestone: -->
     
  • orwelldevcpp

    orwelldevcpp - 2012-10-21

    Fix added to 5.3.0.2. Expect a release after a few days testing.

     
  • orwelldevcpp

    orwelldevcpp - 2012-10-21
    • status: accepted --> fixed
     
  • orwelldevcpp

    orwelldevcpp - 2012-10-21

    I've got one objection though: the fixes proposed in lines 453 to 456 should not contain quotes around $(BIN). Quotes are added to the BIN variable itself when needed, and GCC does not like double double quotes, so it is not needed provide an extra level of quotes:

    if fProject.Options.useGPP then
        writeln(F, #9 + '$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)')
    else
        writeln(F, #9 + '$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)');
    
     

    Last edit: orwelldevcpp 2012-10-21

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.