Hello,
This Makefile is a makefile that creates executable files.
Can you tell me how to change this with a makefile that creates a library (*.a)?
Thank you.
Hello,
This Makefile is a makefile that creates executable files.
Can you tell me how to change this with a makefile that creates a library (*.a)?
Thank you.
Something like,
gcc -c hello.c world.c /* compile hello.o and world.o /
ar rcs libmylib.a hello.o world.o / packe them to limylib.a */
https://renenyffenegger.ch/notes/development/languages/C-C-plus-plus/GCC/create-libraries/index
@forumuser
If you use a modern build system like CMake or Meson it may be easier than writing your Makefiles by hand.
Notes:
There is some level of investment to learing a build system, but It’s usally easier than writing your Makefiles by hand. The above choices are hardly exhaustive, but are the two I use on a regular basis for this purpose. You get a lot for free, like dependency management, generating config files, installing stuff, etc.
@mdegans Thank you 👍😊
Come to Korea after the corona
I’ll buy you a drink.
May take you up on that offer someday. Would love to visit Korea!