makefile - Rebuild specific object based on condition -


I am trying to modify the Geneva mefile of one of the big projects in which there are general / pattern specific rules.

Macfill is compiling and linking in different rules. I have a specific need that if a certain condition is set on the link, then before re-linking I want to call the compilation rule again. The sample issue is below the makefile,

  $ (obj_dir) /% O: $ (src_base) /% Cpp @echo compiling: $ & lt; $ (Q) $ (CSEA) $ (CFFALAGS) $ (REV) $ (CFINICLUDUUUTUH) -o $ @ $ & lt; $ (Link_files): To add @echo $ @ $ (q) $ (cfi) $ (linkflages) -o $ @% O ifeq (1,1) #condition pass So I want to call the ompilation rule again above normal ?? ??? And $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ .   

Step 1: You probably already have it on the original messy file , But here's a framework:

  object: = $ (obj_dir) /foo.o $ (obj_dir) /bar.o $ (obj_dir) /baz.o # You can see a list like this Somewhere, should be constructed in any way $ (Obj_dir) /% O: $ (src_base) /% Cpp @echo compiling: $ & lt; $ (Q) $ (CSEA) $ (CFFALAGS) $ (REV) $ (CFINICLUDUUUTUH) -o $ @ $ & lt; $ (Link_files): $ (objects) @echo $ @ $ (q) $ (cfi) $ (LINKFLAGS) - $$$$  

Make sure to link it properly Works to move forward Specifically, make sure that you can create values ​​for REV in the command line, such as:

  REV = 123  

Step 2: Check recursive call. Make it unconditional at first.

  $ (link_files): $ (objects) add @echo $ @ $ (q) $ (cf) $ (link) $ (link flags) - $$$$$ (make ) REV = $ (NEWREV) $ (objects)  

Step 3: Test conditional.

  $ (link_files): $ (objects) @echo $ @ $ (q) $ (cfa) linking -o $ @ $ ^ $ (make) REV = $ ( Newway) $ (objects) if [1-2 digits]; \ Echo something; \ Else \ echo Do nothing; \ Fi  

Note that this is an shell output statement shell is conditional, not Empty statement statement (statement can be evaluated before running a rule.) If has a tab in front of it, but conditionally in front of other rows There is only empty space.

Step 4: Put it together.

  $ (link_files): $ (objects) @echo $ @ $ (q) $ (cfa) $ linking (LINKFLAGS) - $ $ $ $ $ $ (create) REV = $ (NEWREV) $ (objects) if [1-cuba 2]; \ $ $ (Make) REV = $ (NEWREV) $ (objects); \ Else \ echo Do nothing; \ Fi  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -