Find the answer to your Linux question:
Results 1 to 2 of 2
I have a Makefile something like this: Code: all: libfe libbe libfe: ${ODIR}/${LIBFE} libbe: ${ODIR}/${LIBBE} Now.. I have to report those targets to our Build server where we can see ...
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    59

    Is this the proper way to write Makefile? Please help

    I have a Makefile something like this:

    Code:
    all: libfe libbe
    libfe:  ${ODIR}/${LIBFE}
    libbe:  ${ODIR}/${LIBBE}
    Now.. I have to report those targets to our Build server where we can see the logs if the target is failed. So we have some utilities report_begin and report_end which we are calling from another Makefile called Makefile.rep. and I have to prepend and append these two targets in the main Makefile.

    Here is the Makefile.rep
    Code:
    report_begin:
                  begin_utility -target=$TARGET -server=server
    report_end:
                  end_utility -target=$TARGET -server=server

    I modified the main Makefile in this fashion:

    Code:
    all: libfe libbe
    libfe: TARGET=libfe
    libfe:  report_begin ${ODIR}/${LIBFE} report_end
    
    libbe: TARGET=libbe
    libbe:  report_begin ${ODIR}/${LIBBE} report_end
    Here when I do make all, it calls report_begin and report_end only for first target i.e libfe. and not for libbe. I don;t know why. May be make feels that there is no need to build targets report_begin and report_end.. But I have to call them everytime. Is there any way?

    So, I decided to change it the following way:

    Code:
    libfe:  
          @make report_begin 
          @make ${ODIR}/${LIBFE} 
          @make report_end
    
    libfe:
          @make report_begin
          @make ${ODIR}/${LIBBE}
          @make report_end
    Is this the correct way to write the Makefile? Please help..

  2. #2
    Just Joined!
    Join Date
    Apr 2007
    Posts
    59
    Sorry.. I missed something in the last makefile:

    Code:
    libfe:  
          @make MODULE=libfe report_begin 
          @make ${ODIR}/${LIBFE} 
          @make MODULE=libfe report_end
    
    libbe:
          @make MODULE=libbe report_begin
          @make ${ODIR}/${LIBBE}
          @make MODULE=libbe report_end

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...