Check if a makefile exists before including it

You could do it like that (no if or else)

-include Tool/Rules.mak
include common/Rules-Tool

like this you won’t get an error if Tool/Rules.mak does not exists. (The ‘-‘ does the trick)

In common/Rules-Tool you then use the ?= operator (“conditional variable assignment operator”) to assign values to the variable. This operator will assign the value only if the variable does not exists yet. IOW, it will not overwrite a pre-existing value. If Tool/Rules.mak does not exist or only partially fills in variable common/Rules-Tool will complete them.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)