Compile via makefile?

This is a discussion on Compile via makefile? within the C++ Programming forums, part of the General Programming Boards category; (Borland C++ Free command Line Compiler) Ok, I have tried every make and measure to get this bloody program to ...

  1. #1
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379

    Compile via makefile?

    (Borland C++ Free command Line Compiler)

    Ok, I have tried every make and measure to get this bloody program to work... I'm working through the forgers tutorial and have been stumped for a few days how to add a .rc or .res file. I tried #pragma resource, I tried #include, doesnt work. So, my last option seems to be compiling via makefile.

    I have my makefile (Make.mak) and now I want to compile using its options. This makefile code was taken from the forger, and I only changed the first six lines, sence I have no idea what language this is in:

    Code:
    APP      = Forgers
    EXEFILE  = $(APP).exe
    OBJFILES = $(APP).obj 
    RESFILES = $(APP).res
    LIBFILES =
    DEFFILE  =
    
    .AUTODEPEND
    BCC32   = bcc32
    ILINK32 = ilink32
    BRC32   = brc32
    
    CFLAGS  = -c -tWM- -w -w-par -w-inl -W -a1 -Od
    LFLAGS  = -aa -V4.0 -c -x -Gn
    RFLAGS  = -X -R 
    STDOBJS = c0w32.obj
    STDLIBS = import32.lib cw32.lib
    
    $(EXEFILE) : $(OBJFILES) $(RESFILES)
       $(ILINK32) $(LFLAGS) $(OBJFILES) $(STDOBJS), $(EXEFILE), , \
          $(LIBFILES) $(STDLIBS), $(DEFFILE), $(RESFILES)
    
    clean:
       del *.obj *.res *.tds *.map
    Ok, now I want my compiler to recognize this as the options. But... How? It doesnt like:

    BCC32 [C:\make.mak] C:\Forgers.cpp
    or
    BCC32 [make.mak] C:\forgers.cpp
    or
    BCC32 make.mak C:\forgers.cpp
    or
    BCC32 [-C:\make.mak] C:\forgers.cpp
    or
    BCC32 C:\make.mak C:\forgers.cpp

    All of my attempts at compiling have failed, I'm literaly pulling my hair out. I read through pritty much all of borlands help, but I cant find how to use makefiles to compile this program >.<.

    Thank you in advance !! !! !! !! !! !! !! Alot!!!
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,555
    All other things being equal, try
    make C:\make.mak

  3. #3
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Mmm I have a feeling their is something I didint provide in that makefile. But when I try that, it just goes and says:

    MAKE version 5.2 Copyright (c) 1987, 2000 Borland

    When I try to compile afterwards I get the same error.

    I tried make C:\make.mak BCC32 C:\Forgers.cpp

    but it gives me a fatal error.

    Do I need to supply a path or something in the makefile? I'm very lost :/. Forgive my ultra-noobletness .
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  4. #4
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by Salem
    All other things being equal, try
    make C:\make.mak
    This command would execute make and use makefile or Makefile as input file and execute the rule C:\make.mak.
    Guess that's not what we want.
    To tell make to use another file then makefile or Makefile you have to call make this way

    Code:
    make -f make.mak
    Kurt

  5. #5
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    Thank you for the help Zuk, however I know absolutely zero about makefiles, I tried your method, but it gave me an error :/. I tried moving some stuff/deleting some stuff / adding some sutff, didint help. Google gives me some crazy stuff totaly unrelated, I'm lost again :/.

    I tried to use
    Code:
    make -f C:\Make.mak
    And I got:
    "Line 7: *** missing seperator."

    Heres my makefile code (What language are theyse makefiles written in?)
    Code:
    APP      = Forgers
    EXEFILE  = $(APP).exe
    OBJFILES = $(APP).obj 
    RESFILES = $(APP).res
    LIBFILES = $<windows.h>, "forgers.h"
    DEFFILE  =
    
    .AUTODEPEND
    BCC32   = bcc32
    ILINK32 = ilink32
    BRC32   = brc32
    
    CFLAGS  = -c -tWM- -w -w-par -w-inl -W -a1 -Od
    LFLAGS  = -aa -V4.0 -c -x -Gn
    RFLAGS  = -X -R 
    STDOBJS = c0w32.obj
    STDLIBS = import32.lib cw32.lib
    
    $(EXEFILE) : $(OBJFILES) $(RESFILES)
       $(ILINK32) $(LFLAGS) $(OBJFILES) $(STDOBJS), $(EXEFILE), , \
          $(LIBFILES) $(STDLIBS), $(DEFFILE), $(RESFILES)
    
    clean:
       del *.obj *.res *.tds *.map
    :/.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  6. #6
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Make is very picky about the first character in a rule. It needs to be a tab-character. It wont accept spaces. If the editor you are using ( it looks that way ) expants tabs to spaces make will complain about missing separator.

    Code:
    $(EXEFILE) : $(OBJFILES) $(RESFILES)
       $(ILINK32) $(LFLAGS) $(OBJFILES) $(STDOBJS), $(EXEFILE) // first character on this line must be tab
    Kurt

    edit:
    this line doesn't make sense.
    Code:
    LIBFILES = $<windows.h>, "forgers.h"
    the symbol LIBFILES is used to specify libraries for the linker. You specify system-headers. If you dont have any additional libraries you want to link leave that symbol empty or remove the line.
    edit2:
    You should add the header forgers.h to the list of dependencies of you app instead. like this ( I'm not shure if .AUTODEPEND covers that )

    Code:
    $(EXEFILE) : $(OBJFILES) $(RESFILES) forgers.h
    Last edited by ZuK; 01-20-2006 at 02:29 AM.

  7. #7
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    I changed thoes spots into tabs, removed libfiles and deffiles, it still gives me an error. I even tried spacing thoes lines with "***", didint help.

    Mmm, doesnt seem like much I do even effects this error, I cut out the bottom half, only to leave the variables and the .AUTODEPEND, and it still gave me the error. Heres my code thus far:

    Code:
    APP      = Forgers
    EXEFILE  = $(APP).exe
    OBJFILES = $(APP).obj 
    RESFILES = $(APP).res
    
    .AUTODEPEND
    BCC32   = bcc32
    ILINK32 = ilink32
    BRC32   = brc32
    
    CFLAGS  = -c -tWM- -w -w-par -w-inl -W -a1 -Od
    LFLAGS  = -aa -V4.0 -c -x -Gn
    RFLAGS  = -X -R 
    STDOBJS = c0w32.obj
    STDLIBS = import32.lib cw32.lib
    
    $(EXEFILE) : $(OBJFILES) $(RESFILES) forgers.h
    	$(ILINK32) $(LFLAGS) $(OBJFILES) $(STDOBJS), $(EXEFILE), , /
    		$(LIBFILES) $(STDLIBS), $(DEFFILE), $(RESFILES)
    
    clean:
       del *.obj *.res *.tds *.map
    Mmmm... I'm missing something somewhere. I'm still scouting google :/.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  8. #8
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    I just tried to run your makefile throu gnu-make.
    It doesn't like the line
    Code:
    .AUTODEPEND
    Guess you could remove that.
    And there are still spaces on the actions for the rule clean.
    BTW are you shure that you actually run the borland make ?
    Try make --version
    Kurt

  9. #9
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    Here is a Borland C++ Builder 6 makefile for an empty project called forgers you will need to edit the include paths to reflect your installation and os, otherwise it should be a working makefile.
    for borland's make and compiler only. this format is not functional with any other make or compiler.

    Code:
    # ---------------------------------------------------------------------------
    !if !$d(BCB)
    BCB = $(MAKEDIR)\..
    !endif
    
    # ---------------------------------------------------------------------------
    # IDE SECTION
    # ---------------------------------------------------------------------------
    # The following section of the project makefile is managed by the BCB IDE.
    # It is recommended to use the IDE to change any of the values in this
    # section.
    # ---------------------------------------------------------------------------
    
    VERSION = BCB.06.00
    # ---------------------------------------------------------------------------
    PROJECT = forgers.exe
    OBJFILES = forgers.obj
    RESFILES = forgers.res
    MAINSOURCE = forgers.cpp
    RESDEPEN = $(RESFILES)
    LIBFILES = 
    IDLFILES = 
    IDLGENFILES = 
    LIBRARIES = 
    PACKAGES = vcl.bpi rtl.bpi dbrtl.bpi adortl.bpi vcldb.bpi vclx.bpi bdertl.bpi \
        vcldbx.bpi ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi qrpt.bpi teeui.bpi \
        teedb.bpi tee.bpi dss.bpi teeqr.bpi visualclx.bpi visualdbclx.bpi \
        dsnapcrba.bpi dsnapcon.bpi bcbsmp.bpi vclie.bpi xmlrtl.bpi inet.bpi \
        inetdbbde.bpi inetdbxpress.bpi inetdb.bpi nmfast.bpi webdsnap.bpi \
        bcbie.bpi websnap.bpi soaprtl.bpi dclocx.bpi dbexpress.bpi dbxcds.bpi \
        indy.bpi bcb97axserver.bpi
    SPARELIBS = vcl.lib rtl.lib
    DEFFILE = 
    OTHERFILES = 
    # ---------------------------------------------------------------------------
    DEBUGLIBPATH = $(BCB)\lib\debug
    RELEASELIBPATH = $(BCB)\lib\release
    USERDEFINES = _DEBUG
    SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
    INCLUDEPATH = "C:\Program Files\Borland\CBuilder6\Projects";$(BCB)\include;$(BCB)\include\vcl
    LIBPATH = "C:\Program Files\Borland\CBuilder6\Projects";$(BCB)\lib\obj;$(BCB)\lib
    WARNINGS= -w-par
    PATHCPP = .;
    PATHASM = .;
    PATHPAS = .;
    PATHRC = .;
    PATHOBJ = .;$(LIBPATH)
    # ---------------------------------------------------------------------------
    CFLAG1 = -Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c \
        -tW -tWM
    IDLCFLAGS = -I"C:\Program Files\Borland\CBuilder6\Projects" \
        -I"C:\Documents and Settings\Jaqui\My Documents\programming" \
        -I$(BCB)\include -I$(BCB)\include\vcl -src_suffix cpp -D_DEBUG -boa
    PFLAGS = -$YD -$W -$O- -$A8 -v -JPHNE -M
    RFLAGS = 
    AFLAGS = /mx /w2 /zd
    LFLAGS = -D"" -aa -Tpe -x -Gn -v
    # ---------------------------------------------------------------------------
    ALLOBJ = c0w32.obj $(PACKAGES) Memmgr.Lib sysinit.obj $(OBJFILES)
    ALLRES = $(RESFILES)
    ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
    # ---------------------------------------------------------------------------
    !ifdef IDEOPTIONS
    
    [Version Info]
    IncludeVerInfo=0
    AutoIncBuild=0
    MajorVer=1
    MinorVer=0
    Release=0
    Build=0
    Debug=0
    PreRelease=0
    Special=0
    Private=0
    DLL=0
    
    [Version Info Keys]
    CompanyName=
    FileDescription=
    FileVersion=1.0.0.0
    InternalName=
    LegalCopyright=
    LegalTrademarks=
    OriginalFilename=
    ProductName=
    ProductVersion=1.0.0.0
    Comments=
    
    [Debugging]
    DebugSourceDirs=$(BCB)\source\vcl
    
    !endif
    
    
    
    
    
    # ---------------------------------------------------------------------------
    # MAKE SECTION
    # ---------------------------------------------------------------------------
    # This section of the project file is not used by the BCB IDE.  It is for
    # the benefit of building from the command-line using the MAKE utility.
    # ---------------------------------------------------------------------------
    
    .autodepend
    # ---------------------------------------------------------------------------
    !if "$(USERDEFINES)" != ""
    AUSERDEFINES = -d$(USERDEFINES:;= -d)
    !else
    AUSERDEFINES =
    !endif
    
    !if !$d(BCC32)
    BCC32 = bcc32
    !endif
    
    !if !$d(CPP32)
    CPP32 = cpp32
    !endif
    
    !if !$d(DCC32)
    DCC32 = dcc32
    !endif
    
    !if !$d(TASM32)
    TASM32 = tasm32
    !endif
    
    !if !$d(LINKER)
    LINKER = ilink32
    !endif
    
    !if !$d(BRCC32)
    BRCC32 = brcc32
    !endif
    
    
    # ---------------------------------------------------------------------------
    !if $d(PATHCPP)
    .PATH.CPP = $(PATHCPP)
    .PATH.C   = $(PATHCPP)
    !endif
    
    !if $d(PATHPAS)
    .PATH.PAS = $(PATHPAS)
    !endif
    
    !if $d(PATHASM)
    .PATH.ASM = $(PATHASM)
    !endif
    
    !if $d(PATHRC)
    .PATH.RC  = $(PATHRC)
    !endif
    
    !if $d(PATHOBJ)
    .PATH.OBJ  = $(PATHOBJ)
    !endif
    # ---------------------------------------------------------------------------
    $(PROJECT): $(OTHERFILES) $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)
        $(BCB)\BIN\$(LINKER) @&&!
        $(LFLAGS) -L$(LIBPATH) +
        $(ALLOBJ), +
        $(PROJECT),, +
        $(ALLLIB), +
        $(DEFFILE), +
        $(ALLRES)
    !
    # ---------------------------------------------------------------------------
    .pas.hpp:
        $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }
    
    .pas.obj:
        $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< }
    
    .cpp.obj:
        $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }
    
    .c.obj:
        $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< }
    
    .c.i:
        $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }
    
    .cpp.i:
        $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< }
    
    .asm.obj:
        $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@
    
    .rc.res:
        $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<
    
    
    
    # ---------------------------------------------------------------------------
    Last edited by Jaqui; 01-20-2006 at 03:51 AM.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  10. #10
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    O_O wow... My version was a bit... Lacking.

    But, it gives me an error, it absolutely hates this:
    Code:
    PACKAGES = vcl.bpi rtl.bpi dbrtl.bpi adortl.bpi vcldb.bpi vclx.bpi bdertl.bpi \
        vcldbx.bpi ibxpress.bpi dsnap.bpi cds.bpi bdecds.bpi qrpt.bpi teeui.bpi \
        teedb.bpi tee.bpi dss.bpi teeqr.bpi visualclx.bpi visualdbclx.bpi \
        dsnapcrba.bpi dsnapcon.bpi bcbsmp.bpi vclie.bpi xmlrtl.bpi inet.bpi \
        inetdbbde.bpi inetdbxpress.bpi inetdb.bpi nmfast.bpi webdsnap.bpi \
        bcbie.bpi websnap.bpi soaprtl.bpi dclocx.bpi dbexpress.bpi dbxcds.bpi \
        indy.bpi bcb97axserver.bpi
    It brings up an error for vcl.bpi, when I delete that it gives me an error for rtl.bpi, ect. I tried deleting the whole package section, gave me an error "Cannot open file: 'MEMMGR.lib'". I edited the paths as necesary, they makefiles just seem to hate me :/.

    Thank you very much for the code though, I can imagine it took awhile!
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  11. #11
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You won't be able to use jaqui's auto-generated bcb makefile with the command line tools without modifying it so much that it will probably end up resembling the original makefile you posted.

    Assuming you have properly configured the command line tools for use it would be more useful if you explicitly state the exact errors/warnings you are getting when you run:

    make -f name_of_makefile

    where name_of_makefile is the name of the makefile you are actually using (this should be the one you first posted - 'Make.mak'?).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  12. #12
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    actually Ken the project name matches the one in his example, if he is using borland's command line tools it should work [ if the versions of builder matching ], but I bet he also has another compiler instaled and that is the make and compiler that are "default" when invoked at the command prompt.

    a path in the invocation of make might clear it up.
    ie:
    c:\Progran Files\Borland\Builder\bin\make -f makefile.mak

    Blackroot, as Ken noted, the makefile I posted was autogenerated by builder, you can export the makefile from builder in the project menu.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  13. #13
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    The command line tools don't come with vcl so any and all references to it would have to be removed, including various linker and compiler flags. So, as I said, after you'd pruned it back you'd probably end up with the original makefile, more or less.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  14. #14
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    the part labelled:
    Code:
    # ---------------------------------------------------------------------------
    # MAKE SECTION
    # ---------------------------------------------------------------------------
    # This section of the project file is not used by the BCB IDE.  It is for
    # the benefit of building from the command-line using the MAKE utility.
    # ---------------------------------------------------------------------------
    everything above that is ide specific codes, below is the command prompt makefile.



    quite a bit more complex than the original makefile posted.
    I was lucky that I was at a friend's when I read it, and was able to use his builder 6 to even generate a borland makefile.

    my linux based tools use automake to generate the makefiles.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  15. #15
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    It's a fair cop - I confess I didn't read that bit, just read the post about vcl errors.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Makefile Problem: None rule to make target
    By chris24300 in forum Linux Programming
    Replies: 25
    Last Post: 06-17-2009, 09:45 AM
  2. makefile
    By twans in forum C++ Programming
    Replies: 3
    Last Post: 04-08-2005, 12:16 AM
  3. using a makefile / gdb info
    By dinjas in forum C Programming
    Replies: 2
    Last Post: 02-22-2005, 05:42 PM
  4. about Makefile and Macro
    By tom_mk in forum C++ Programming
    Replies: 1
    Last Post: 09-18-2003, 01:07 PM
  5. makefile woes
    By Grifftt in forum C Programming
    Replies: 2
    Last Post: 12-06-2002, 03:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21