There is a tree of files:
folder |-src |-myfile.cpp |-myfile.h |-bin |-Makefile I want to write a Makefile so that the files in the src directory are compiled, but the object files are created in the current one (in the folder). And then, so that they link into one file in the bin directory.
At the moment I have a non-working Makefile. Swears at the lack of rules for myfile.o.
TARGET=myfile OBJECTS=myfile.o XX=g++ CXXFLAGS=-std=c++11 all: ${TARGET} ${TARGET}: ${OBJECTS} ${XX} -o ${TARGET} ${OBJECTS} .co: ${XX} ${CXXFLAGS} -c "${INCLUDE}$<" -o "$@" How to properly implement the task?
file.cppandfile.hin an empty directory and executemake CXXFLAGS="-std=c++11" filein this directory. Perhaps the result will amaze you, and make you think that what you have in mind, in a sense, can be called "inventing problems out of the blue." - aleksandr barakinmyfile,myfile.o,file.cppandfile.hare related to each other. - aleksandr barakin