My current makefile worked fine. But since then some files have been moved to a different new 'Common' directory. So what should my makefile look like to build this scenario. Currently (cut down version pasted here):
SERVER_OLIST = file1.o file2.o file3.o $(CRYPT_LIST)
INCLUDES =
LIBRARIES = -lpthread -lrt `mysql_config --cflags` `mysql_config --libs`
DEFINES =
VERSION_DEFINES = -DBUILD_VERSION='"1.3.0"'
COMPILE_OPTIONS = -posix -fexceptions $(DEFINES)
LINK_OPTIONS = -posix
all: loraserver loracmd
loraserver: testbuild
cp $^ $@
.PHONY: updateBuildTime
updateBuildTime:
rm -f BuildVersion.o
testbuild: updateBuildTime $(SERVER_OLIST)
g++ -o $@ $(SERVER_OLIST) $(LINK_OPTIONS) $(LIBRARIES)
and so I tried this with server list changed to be:
SERVER_OLIST = file1.o ../Common/file2.o file3.o $(CRYPT_LIST)
but when it tried to build it said: 'No rule to make target ../Common/file2.o needed by 'testbuild' Rather than rewrite the whole makefile is there a way of specifying different dirs for different files ?