makefile中命令`-rm`中的破折号意味着什么?

时间:2018-04-30 12:45:43

标签: makefile gnu-make

今天我在makefile中看到了一些奇怪的东西。

-中的-rm是一个错字,还是意味着什么?

appname = hello
obj = hello.o
gcc = gcc
cflags = -g -Wall

$(appname):$(obj)
    $(gcc) $(cflags) $(obj) -o $(app) -lpthread

# p_test.o:p_test.c
#   $(gcc) $(cflags) -c  hello.c

.PHONY:clean
clean:
    -rm $(obj)

.PHONY:run
run:
    ./hello 1

1 个答案:

答案 0 :(得分:0)

这意味着忽略错误,请参阅the fine manual

因此,如果make在发出$(obj)make clean不存在,则curl -X POST \ https://connect.squareup.com/v2/locations/*****/orders \ -H 'Authorization: Bearer ******' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -H 'Postman-Token: ******' \ -d '{ "idempotency_key": "123456AZD", "reference_id": "my-order-006", "line_items": [ { "name": "Américain - Article de base", "quantity": "1", "base_price_money": { "amount": 1599, "currency": "EUR" } } ], "taxes": [ ], "discounts": [ ] }' 不会失败。