Menu

rule to link all .o into libx.a if user does not specify ' libx.a: <list of .o> ' in makefile

Help
2017-12-12
2017-12-14
  • Justin Huang

    Justin Huang - 2017-12-12

    Hi,

    I'd like to write a makepp rule which links .o files into .a file.

    If user specifies the dependencies of .a like this:

    libx.a: a.o b.o c.o
    libx.a: d.o

    then we will link a/b/c/d.o into libx.a.

    If user does not specify dependencies of libx.a, then I'd like to link all .o files that can be built into libx.a.

    Can anyone help this?

    Thanks,
    Justin

     
  • Justin Huang

    Justin Huang - 2017-12-14

    Never mind.
    I can do this with scanner. I register scanner for this command, and thus it knows the implicit .o dependencies from command line. In the command, I will link $^ if $^ is non-empty, otherwise I will link all .o.

     

Log in to post a comment.

MongoDB Logo MongoDB