Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in makefile, what does a sole dash as the target of a rule mean?

Tags:

makefile

I see a file .missing-syscalls.d which contains

-:  /home/ckim/MVP/snake_linux_3.3.mvpe/include/linux/kconfig.h \
 include/generated/autoconf.h \
 /home/ckim/MVP/snake_linux_3.3.mvpe/arch/sparc/include/asm/types.h \
 include/asm-generic/int-ll64.h \
 /home/ckim/MVP/snake_linux_3.3.mvpe/arch/sparc/include/asm/bitsperlong.h \
 include/asm-generic/bitsperlong.h \
 /home/ckim/MVP/snake_linux_3.3.mvpe/arch/sparc/include/asm/unistd.h

I know .d file is only for showing dependancy. But what is '-' as the target?

like image 580
Chan Kim Avatar asked Aug 15 '14 12:08

Chan Kim


1 Answers

Hyphen prior to commands in makefiles is used to suppress errors and continue instead of failing like this:

clean:
        -rm -f *.o

The same way goes for include syntax in makefiles to suppress the error messages that would otherwise appear if the file isn't available like this:

-include $(SRC:%.c=%.d)

I would assume the .missing-syscalls.d file is used the same way, ignoring non-existing header files it attempts to include.

like image 160
Arnestig Avatar answered Sep 28 '22 03:09

Arnestig