Makefile for a library

后端 未结 3 1093
余生分开走
余生分开走 2021-02-05 23:34

I have to run these 4 commands on the terminal each time I want to execute the program using libraries.

The lines are

cc -m32 -c mylib.c
ar -rcs libmyli         


        
3条回答
  •  醉酒成梦
    2021-02-06 00:06

    I think there is no more detailed procedure than the official documentation of the make command: http://www.gnu.org/software/make/manual/make.html#Overview

    Basically you will have to create a target and just put your commands in it. The target could be 'all' if you want it to work when you type 'make'. A good makefile will surely use variables etc to keep it flexible over the lib/sources additions.

提交回复
热议问题