How to write a makefile that builds only the libraries?
I have set of libraries that I use for my application development. Whenever I build the application all libraries are rebuilt. Me and my team team feel it is really unnecessarily to build libraries again and again.
How would I make a makefile which will build all libraries and application independently? I mean to say, When I build my app I want to avoid building all libraries that 开发者_开发技巧are already built.
Suggest some opinions.
Edit: Description: my app is called xyz and all source files are present in ./src/xyz directory. It depends upon libraries like ssh and net-snmp. And both net-snmp and ssh are put in ./lib directory.
Now whenever the app is built all libraries are re-built. Here I do not modify the library packages that are needed for my app.
It takes nearly an hours time to build. at each build libraries are re-built and this is not required.
Now, My Question? How do I write a makefile that will build libraries and app separately.
You have not given us nearly enough information to give a detailed answer, but here's the outline:
LIBRARIES = ./lib/ssh ./lib/net-snmp
SOURCES = foo bar baz
xyz: $(LIBRARIES) $(SOURCES)
command-that-rebuilds-app-from-sources-and-libraries
./lib/ssh: things-that-ssh-needs
command-that-rebuilds-ssh
./lib/net-snmp: things-that-net-snmp-needs
command-that-rebuilds-net-snmp
XPATH: ./src
精彩评论