How do I add a debug option to Makefile

前端 未结 2 1534
孤独总比滥情好
孤独总比滥情好 2020-12-22 07:16

I\'ve got the below simple Makefile which I use for compiling a C program:

all:
    gcc -Wall -o myfile myfile.c lol_dht22/dht22.c lol_dht22/locking.c -lwiri         


        
2条回答
  •  遥遥无期
    2020-12-22 07:35

    Here's an example makefile that has the two options you are looking for.

    all:
        gcc -Wall -o myfile myfile.c lol_dht22/dht22.c lol_dht22/locking.c -lwiringPi -lcurl -lm
    debug:
        gcc -DDEBUG -Wall -o myfile myfile.c lol_dht22/dht22.c lol_dht22/locking.c -lwiringPi -lcurl -lm
    

    You just needed to add a debug option, which is done in similar fashion to the 'all' option you had already declared.

提交回复
热议问题