This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to specify a relative directory in makefile

How to specify a relative directory in makefile. My c51 compiler version is 5.10. Whether the directive"INCDIR" could be used in makefile? what format for it?

Thanks for any help in advance!

Parents
  • for help with your specific version of make, you'll have to read the appropriate Manual.

    What does your C51 Manual say about the INCDIR directive?
    The current C51 version just supports any valid path - relative or absolute.

    The latest tools are fine with long filenames, but can have problems with spaces in file or pathnames - you might well find that an old version like yours supports neither.

Reply
  • for help with your specific version of make, you'll have to read the appropriate Manual.

    What does your C51 Manual say about the INCDIR directive?
    The current C51 version just supports any valid path - relative or absolute.

    The latest tools are fine with long filenames, but can have problems with spaces in file or pathnames - you might well find that an old version like yours supports neither.

Children
  • Thank you, Neil.

    It is a great pity that the Manual has not touched this point.
    I had done a experiment for the directive (INCDIR) and found it seems not to be used in Makefile. Maybe the syntax for INCDIR in my makefile is not correct. The copiler and linker version for C51 that I can use is very old(C51 ver 5.10, BL ver 4.02). Because my project must be built in command line, I must supply a makefile for build.
    How can I write a right makefile for my project?
    Could anyone post a makefile sample for me in the forum?

    I post my makefile as follows:

    ###########################
    # DEFINE COMPILER OPTIONS #
    ###########################
    C51PATH = E:\winxp\C51
    AS = ML
    AFLAGS = /c
    LINK = LINK # DB : DEBUG
    CC = TC # OE : OBJEXTENTED
    CFLAGS = /c # NOPR : NOPRINT
    A51 = $(C51PATH)\BIN\A51 # WL(1) : WARNINGLEVEL 1
    C51 = $(C51PATH)\BIN\C51 # SB : SYMBOL
    A51FLAGS = DB NOPR # PP : PREPRINT
    NOAM # PP : PREPRINT
    C51FLAGS = DB OE PR WL(1) NOAM # PR : PRINT
    L51 = $(C51PATH)\BIN\L51 # DS : DEBUGSYMBOLS
    L51FLAGS = DS DL NOSY NOLI RS(256) OL # DL : DEBUGLINESO51 = $(C51PATH)\BIN\OHS51 # NOSY : NOSYMBOLS



    #############################################
    # Header file macro
    ############################################
    TYPEDEF_H = ..\..\Include\typedef.h

    SYSINFO_H = ..\..\SysInfo\sysinfo.h \
    ..\..\SysInfo\sv_const.h

    VIDEOAPI_H = ..\video\VideoApi.h

    OSDTEMP_H = .\Osdtemp\ttxfont.h \
    .\Osdtemp\ttxosd.h

    C51_TEMP_H = ..\..\UI\temp\osd_prv.h \
    ..\..\UI\temp\osdapi.h

    CCSERVICE_H = .\CCApi.h

    CC_COM_H = .\common.h


    #############################################
    # Source file #############################################

    OSDTEMP_C = .\Osdtemp\ttxosd.c

    CCSERVICE_C = .\CCApi.c

    OSDAPI_C = ..\..\UI\temp\osdapi.c

    VIDEOAPI_C = ..\Video\VideoApi.c

    #############################################
    # L51 Bank Configuration
    #############################################
    L51_BANK_A51 = ..\..\UI\l51bank\l51bank8.a51

    #############################################
    # OBJ files
    #############################################
    OBJS = $(OSDTEMP_C:.c=.obj) \
    $(OSDAPI_C:.c=.obj) \
    $(VIDEOAPI_C:.c=.obj) \
    $(CCSERVICE_C:.c=.obj)

    #############################################
    # INC files
    #############################################
    INCFILES = $(TYPEDEF_H) \
    $(SYSINFO_H) \
    $(C51_TEMP_H) \
    $(OSDTEMP_H) \
    $(VIDEOAPI_H) \
    $(CCSERVICE_H) \
    $(CC_COM_H) \

    INCLUDES= INCDIR(..\..\Include\;.\Osdtemp\;..\..\UI\temp\;..\..\SysInfo\;.\)

    ############################################
    # LIST file for 51 ASM
    ############################################
    LIST = $(OSDTEMP_C:.c=.lst) \
    $(OSDAPI_C:.c=.lst) \
    $(VIDEOAPI_C:.c=.lst) \
    $(CCSERVICE_C:.c=.lst)

    ############################################
    #Compiler config
    ###########################################

    ALL_FLAGS = DEFINE(KEIL_C51_COMPILER, KEIL_IDE_ERR, CC_MODULE) $(C51FLAGS)

    #make all
    all : $(OBJS)

    ##clean all intermedia files
    clean:
    -@del $(OBJS)
    -@del $(LIST)



    ###########################################
    #temp file for OSD TTX source files
    ##########################################
    .\Osdtemp\ttxosd.obj : .\Osdtemp\ttxosd.c $(INCFILES)
    $(C51) .\Osdtemp\ttxosd.c $(ALL_FLAGS)

    ############################################
    #CC service source files
    ##########################################
    .\CCApi.obj : .\CCApi.c $(INCFILES)
    $(C51) .\CCApi.c $(ALL_FLAGS)


    ##########################################
    #video service source files
    ###########################################
    ..\Video\VideoApi.obj : ..\Video\VideoApi.c $(INCFILES)
    $(C51) ..\Video\VideoApi.c $(ALL_FLAGS)

    ##########################################
    #osd source files
    ###########################################
    ..\..\UI\temp\osdapi.obj : ..\..\UI\temp\osdapi.c $(INCFILES)
    $(C51) ..\..\UI\temp\osdapi.c $(ALL_FLAGS)



    ################################
    # L51 Bank Configuration
    ################################
    ..\..\UI\l51bank\l51bank8.obj : ..\..\UI\l51bank\l51bank8.a51
    $(A51) ..\..\UI\l51bank\l51bank8.a51 $(A51FLAGS)

  • The manual explains how to use the compiler. The make utility you're using comes from elsewhere, so it shouldn't really surprise you that it's not covered by the Keil manual. You'll have to read the manual for that make, too.

    The problem with your posted makefile has nothing to do with the Keil tools.

    It doesn't use your defined INCLUDES variable because you simply never told it how. You'll have to put that variable into your commands yourself, e.g. by adding $(INCLUDES) to the definitions of ALL_FLAGS and/or A51FLAGS.

  • Hi, Hans-Bernhard,

    Thanks for your response!

    Yes, You are right! The make utility I'm using is borland make(ver 5.20).
    I had done an experiment and the statements had been modified as follows:
    C51FLAGS = DB OE PR WL(1) NOAM $(INCLUDES)

    When make file was invoked by make utility, the error message ocurred "FATAL: unenable to execute command".

    I mean that I want to use the definition "INCUDES" for C51 compiler.
    what should I do?

    Anyone has the material on how to use borland make utility, please send me a copy or give me a link address.
    Thanks !

  • "Anyone has the material on how to use borland make utility"

    Err... Borland?!

    Have you read your Borland manuals, visited the Borland site, looked on the Borland forums?

  • "FATAL: unenable to execute command"

    That rather certainly means the command line became too long for Borland make to pass to a program without help. Learn about the use of response files.

    [And please redirect this inquiry to the proper place --- Borland does run a newsgroup server...]