gnu make - Makefile dependencies variable -
i have simple makefile. when i'm not using variable in dependencies list works fine. otherwise gives fallowing error:
make: *** no rule make target 'ext/configxml.o', needed 'libledrgb-jni.so'. stop.
furthermore when
make print-led-cfg-src led-cfg-src = ../led-cfg/src
so value set properly, altough if explicitly add rule file:
ext/configxml.o: $(led-cfg-src)/%.cc @echo 'building file: $<' @${cxx} $(cxxflags) -c -o "$@" "$<"
it looks problem led-cfg-src source file:
make ext/configxml.o make: *** no rule make target '/configxml.cc', needed 'ext/configxml.o'. stop.
but file exists:
make list ls -la ../led-cfg/src total 340 drwxrwxr-x 2 gigi gigi 4096 lip 27 13:10 . drwxrwxr-x 12 gigi gigi 4096 lip 28 10:08 .. -rw-rw-r-- 1 gigi gigi 11918 lip 28 09:54 configxml.cc -rw-rw-r-- 1 gigi gigi 2891 lip 27 13:17 configxml.h
here's source makefile:
extobjs = ext/configxml.o ext/packet.o ext/tinyxml2.o ext/crypt.o ext/rozkaz.o led-cfg-src := ../led-cfg/src/ includes := -i$(led-cfg-src) cxxflags := $(includes) library := libledrgb-jni.so cxxflags := $(includes) -fpic -std=c++14 all: dirs $(library) $(library): $(objfiles) $(extobjs) $(cxx) -shared -o $@ $^ ext/%.o: $(led-cfg-src)/%.cc @echo 'building file: $<' @${cxx} $(cxxflags) -c -o "$@" "$<" clean: rm -rf $(extobjs) list: ls -la $(led-cfg-src) print-% : ; @echo $* = $($*) .phony: clean dirs
i'm using gnu make 4.1
shot in dark. @ least in makefile
listing have posted, there redundant undesired whitespace in definition of led-cfg-src
variable:
led-cfg-src := ../led-cfg/src/<there-is-reduntant-whitespace-here>
that means, when variable expanded in rule definition later, make
see ../led-cfg/src/ %.cc
(two words, $<
= ../led-cfg/src/
, , %.cc
being additional dependency) instead of expected ../led-cfg/src/%.cc
.
you should activate display of non-printable characters in editor, since make
in places extremely picky whitespaces: chooses strip automatically, keeps. here: make
had stipped whitespace in front of ../led-cfg/src/
, kept 1 @ end.
Comments
Post a Comment