mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 22:17:01 +08:00
[nps] separate makefile for nps target
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#
|
||||
# Copyright (C) 2012 The Paparazzi Team
|
||||
#
|
||||
# This file is part of paparazzi.
|
||||
#
|
||||
# paparazzi is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# paparazzi is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with paparazzi; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
|
||||
#
|
||||
# This is the common Makefile for the nps target.
|
||||
#
|
||||
|
||||
SRC_ARCH = arch/sim
|
||||
|
||||
CC = g++
|
||||
|
||||
SIMDIR = $(PAPARAZZI_SRC)/sw/simulator
|
||||
|
||||
# Launch with "make Q=''" to get full command display
|
||||
Q=@
|
||||
|
||||
CFLAGS = -W -Wall
|
||||
CFLAGS += $(INCLUDES)
|
||||
CFLAGS += $($(TARGET).CFLAGS)
|
||||
CFLAGS += $(LOCAL_CFLAGS)
|
||||
CFLAGS += -O2
|
||||
CFLAGS += -g
|
||||
|
||||
LDFLAGS += $($(TARGET).LDFLAGS)
|
||||
|
||||
#
|
||||
# General rules
|
||||
#
|
||||
|
||||
$(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
|
||||
$(TARGET).objso = $($(TARGET).srcs:%.c=$(OBJDIR)/%.o)
|
||||
$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o)
|
||||
|
||||
all compile: check_jsbsim $(OBJDIR)/simsitl
|
||||
|
||||
|
||||
check_jsbsim:
|
||||
@echo Paparazzi jsbsim package found: $(JSBSIM_PKG)
|
||||
|
||||
|
||||
$(OBJDIR)/simsitl : $($(TARGET).objs)
|
||||
@echo LD $@
|
||||
$(Q)$(CC) $(CFLAGS) -o $@ $($(TARGET).objs) $(LDFLAGS)
|
||||
|
||||
|
||||
%.s: %.c
|
||||
$(CC) $(CFLAGS) -S -o $@ $<
|
||||
|
||||
%.s: %.cpp
|
||||
$(CC) $(CFLAGS) -S -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.s: %.c
|
||||
@echo CC $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -S -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.s: %.cpp
|
||||
@echo CC $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -S -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.c $(OBJDIR)/../Makefile.ac
|
||||
@echo CC $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac
|
||||
@echo CC $@
|
||||
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
|
||||
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
$(OBJDIR)/.depend:
|
||||
@test -d $(OBJDIR) || mkdir -p $(OBJDIR)
|
||||
@echo DEPEND $@
|
||||
$(Q)$(CC) -MM -MG $(CFLAGS) $($(TARGET).srcs) | sed 's|\([^\.]*\.o\)|$(OBJDIR)/\1|' > $@
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifneq ($(MAKECMDGOALS),erase)
|
||||
-include $(OBJDIR)/.depend
|
||||
endif
|
||||
endif
|
||||
@@ -4,8 +4,6 @@
|
||||
# SITL Simulator
|
||||
#
|
||||
|
||||
SIM_TYPE = JSBSIM
|
||||
|
||||
JSBSIM_ROOT = /opt/jsbsim
|
||||
JSBSIM_INC = $(JSBSIM_ROOT)/include/JSBSim
|
||||
JSBSIM_LIB = $(JSBSIM_ROOT)/lib
|
||||
@@ -19,6 +17,9 @@ NPSDIR = $(SIMDIR)/nps
|
||||
|
||||
nps.ARCHDIR = sim
|
||||
|
||||
# include Makefile.nps instead of Makefile.sim
|
||||
nps.MAKEFILE = nps
|
||||
|
||||
nps.CFLAGS += -DSITL -DUSE_NPS
|
||||
nps.CFLAGS += `pkg-config glib-2.0 --cflags`
|
||||
nps.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lglibivy -lgsl -lgslcblas
|
||||
|
||||
@@ -37,10 +37,14 @@ ifneq ($(MAKECMDGOALS),clean)
|
||||
# check if ARCHDIR is set
|
||||
ifeq ($($(TARGET).ARCHDIR), )
|
||||
$(error Architecture not set, maybe you forgot to add the target? e.g. <target name="tunnel" board="twog_1.0"/>)
|
||||
else
|
||||
ifdef $(TARGET).MAKEFILE
|
||||
include ../../conf/Makefile.$($(TARGET).MAKEFILE)
|
||||
else
|
||||
include ../../conf/Makefile.$($(TARGET).ARCHDIR)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# check for obsolete MODEM_UART_NR and GPS_UART_NR makefile vars
|
||||
ifdef GPS_UART_NR
|
||||
|
||||
Reference in New Issue
Block a user