Skip to content

Instantly share code, notes, and snippets.

@gatspy
Forked from rosado/Makefile
Created April 26, 2020 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gatspy/2e8dd5fa539c7a70d1ccaab941913b74 to your computer and use it in GitHub Desktop.
Save gatspy/2e8dd5fa539c7a70d1ccaab941913b74 to your computer and use it in GitHub Desktop.
test if directory exists in a makefile
all: txtfile
TARGET_DIR = target-dir
txtfile: $(TARGET_DIR)
touch $(TARGET_DIR)/file.txt
target-dir:
test ! -d $(TARGET_DIR) && mkdir $(TARGET_DIR)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment