mmmmm
mmmmm

Reputation: 143

What does prefix @- mean in makefile?

What does the prefix @- mean in a makefile? Any difference from using @ without -? For example, in the following case:

ifndef NO_CBLAS
    @echo Generating cblas.h in $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)
    @sed 's/common/openblas_config/g' cblas.h > $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/cblas.h
endif

ifndef NO_LAPACKE
    @echo Copying LAPACKE header files to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
    @-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke.h
    @-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_config.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke_config.h
    @-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_mangling_with_flags.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke_mangling.h
    @-install -pDm644 $(NETLIB_LAPACK_DIR)/lapacke/include/lapacke_utils.h $(DESTDIR)$(OPENBLAS_INCLUDE_DIR)/lapacke_utils.h
endif
ifndef NO_STATIC
    @echo Copying the static library to $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
    @install -pm644 $(LIBNAME) $(DESTDIR)$(OPENBLAS_LIBRARY_DIR)
    @cd $(DESTDIR)$(OPENBLAS_LIBRARY_DIR) ; \
    ln -fs $(LIBNAME) $(LIBPREFIX).$(LIBSUFFIX)
endif

Upvotes: 12

Views: 5697

Answers (1)

Etan Reisner
Etan Reisner

Reputation: 80961

Section 5 Writing Recipes in Rules of the GNU make Manual has information about both of these things in it. Specifically section 5.2 and 5.5.

5.2 Recipe Echoing

Normally make prints each line of the recipe before it is executed. We call this echoing because it gives the appearance that you are typing the lines yourself.

When a line starts with ‘@’, the echoing of that line is suppressed. The ‘@’ is discarded before the line is passed to the shell. Typically you would use this for a command whose only effect is to print something, such as an echo command to indicate progress through the makefile:

and

5.5 Errors in Recipes

After each shell invocation returns, make looks at its exit status. If the shell completed successfully (the exit status is zero), the next line in the recipe is executed in a new shell; after the last line is finished, the rule is finished.

If there is an error (the exit status is nonzero), make gives up on the current rule, and perhaps on all rules.

Sometimes the failure of a certain recipe line does not indicate a problem. For example, you may use the mkdir command to ensure that a directory exists. If the directory already exists, mkdir will report an error, but you probably want make to continue regardless.

To ignore errors in a recipe line, write a ‘-’ at the beginning of the line’s text (after the initial tab). The ‘-’ is discarded before the line is passed to the shell for execution.

Upvotes: 15

Related Questions