I want to add a couple of lines so that the make process can error out if certain directory (set by a Makefile variable DIR1) doesn't exist. Here is the added part but this errors out even if I the directory set by DIR1 exists. For example, I made the directory called 'dir1' but make errors out. What is wrong?
DIR1 = dir1
.PHONY : check_dir
$(info DIR1 = $(DIR1))
check_dir:
if [ ! -d $(DIR1) ]; then \
$(error "DIR1 does not exist! check Makefile!"); \
fi
This is the run result.(I have directory called dir1
in current directory).
> ckim@chan-ubuntu:~/testmake/test1$ make
> DIR1 = dir1 Makefile:8:
> *** "DIR1 does not exist! check Makefile!". Stop.