Closed andrewdavidsmith closed 3 years ago
I think if we include $(CPPFLAGS)
and $(LDFLAGS)
in the wildcard expansion lines, it should work. Like this:
%.o: %.cpp %.hpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -c -o $@ $< $(INCLUDEARGS)
%: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(INCLUDEARGS) $(LIBS)
I think there are two parts to this (1) we should be using the appropriate variable names to conform to GNU auto tools stuff, and (2) we need to be able to have them passed in by the users on the make command line.
I think your solution above solves the problem, but we need to be clear on whether they should be entirely overridden by a user or just allow a user to update them (with other things added within the Makefile). We also need to be sure that names like INCLUDEARGS
aren't just replacing something more standard within the auto tools framework.
Fixed by using CPPFLAGS
, LDFLAGS
, and LDLIBS
, along with override CPPFLAGS += $(INCLUDEARGS)
style for updating these vars from command line.
If make is done from a clone of the repo and not using an autotools build, there is no way to pass
LDFLAGS
,CPPFLAGS
, etc., to the make process.