jeudi 11 avril 2019

How to check whether a file exists, outside a Makefile rule?

This is a pseudo code:

if .gitignore exists 
    GITIGNORE_PATH := .gitignore
else
    GITIGNORE_PATH := ../.gitignore
fi

all: 
    do_build...

I tried to search this, but they always show how to do this inside rules, as in:

$(UBIN)/%:
    @if [ -f '$@' ]; then \
        $(CC) $(CFLAGS) -o '$@' $(OBJS) -L $(ORAHOME) $(ORALIBS) \
        $(LNKPATH) $(DSTN_LIBS); \
        echo ""; \
    fi

  1. Testing if a file exists in a make file
  2. Testing if a file exists in makefile target, and quitting if not present
  3. How to check if a file exists in a makefile

Aucun commentaire:

Enregistrer un commentaire