Skip to content

Instantly share code, notes, and snippets.

@rosado
Last active February 2, 2022 00:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rosado/b349f6f053274f1a3336 to your computer and use it in GitHub Desktop.
Save rosado/b349f6f053274f1a3336 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