mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 13:55:40 +08:00
[build system] use VPATH to specify search path for NPS files
add $(PAPARAZZI_SRC)/sw/simulator to VPATH, so that makes adds that to the search path. This makes it possible to add NPS sources as nps/foo.c to $(TARGET).srcs, and the object and dependency files will correctly be put into $(PAPARAZZI_HOME)/var/aircrafts/<ac>/nps/<src file> So e.g. /home/<user>/paparazzi/var/aircrafts/Quad_LisaM_2/nps/nps/nps_main.o While here, also generate the .d dependency files during the compilation run instead of a separate run. fixes #798
This commit is contained in:
+5
-15
@@ -27,7 +27,6 @@
|
||||
SRC_ARCH = arch/sim
|
||||
|
||||
OPT ?= 2
|
||||
SIMDIR = $(PAPARAZZI_SRC)/sw/simulator
|
||||
|
||||
# Launch with "make Q=''" to get full command display
|
||||
Q=@
|
||||
@@ -91,29 +90,20 @@ $(OBJDIR)/%.s: %.cpp
|
||||
$(OBJDIR)/%.o: %.c $(OBJDIR)/../Makefile.ac
|
||||
@echo CC $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
||||
$(Q)$(CC) -MMD $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac
|
||||
@echo CXX $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(Q)$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
$(Q)$(CXX) -MMD $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
.PHONY: all compile check_jsbsim
|
||||
|
||||
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
|
||||
$(OBJDIR)/%.d: %.c
|
||||
@echo DEP $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(Q)$(CC) -MM -MG $(CFLAGS) $< | sed 's|\([^\.]*\.o\)|$(OBJDIR)/\1|' > $(OBJDIR)/$*.d
|
||||
|
||||
$(OBJDIR)/%.d: %.cpp $(OBJDIR)/../Makefile.ac
|
||||
@echo DEP $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(Q)$(CXX) -MM -MG $(CXXFLAGS) $< | sed 's|\([^\.]*\.o\)|$(OBJDIR)/\1|' > $(OBJDIR)/$*.d
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
-include $($(TARGET).objs:.o=.d)
|
||||
DEPS = $(addprefix $(OBJDIR)/,$($(TARGET).srcs:.c=.d))
|
||||
-include $(DEPS)
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user