Annoying issue with make, will not auto create build directory
I have a make file that gathers some local information and uses it (in theory) to create a locally named build directory if it doesn’t exist.Code:12345678910111213141516171819SOURCELOC = ./src# get version of g++CMP := $(shell g++ --version | cut -d ' ' -f 3 | sed q)CMP := gcc-$(CMP)# create build location nameOS := $(shell uname -s)ARCH := $(shell uname -m)KERN := $(shell uname -r | cut -d. -f 1,2)BDIR := bld_$(OS)_$(KERN).$(ARCH)_$(CMP)#test print$(info OS is : $(OS))$(info BDIR is: $(BDIR))# create build directory if it doesn't exist$(BDIR):@mkdir -p $(BDIR)
The test print code prints what I would expect,Code:12OS is : CYGWIN_NT-5.1BDIR is: bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3
I get an error,Code:1234Assembler messages:Fatal error: can't create bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o: No such file or directoryMAKE_SMD1.mak:73: recipe for target 'bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o' failedmake: *** [bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3/main.o] Error 1
If I manually create the build directory, bld_CYGWIN_NT-5.1_2.3.i686_gcc-4.9.3, the compiler continues and creates the first object, main.o. I have had this issue off and on and can’t seem to identify where the problem is. In some cases, the directory doesn’t get created and in others it does. I use the same syntax for mkdir in every make, so I’m not sure where I am going wrong. It’s not the end of the world to have to make a directory but the point of what I am trying to set up is for some of this to be automated based on whatever system I am booted into. The “@ mkdir” statement is indented with a tab if that isn’t clear with this formatting.
Suggestions would be appreciated.
You must be logged in to reply to this topic.