forked from matejkarasek/paparazzi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.nps
112 lines (88 loc) · 2.72 KB
/
Makefile.nps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# 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
OPT ?= 2
# Slightly bigger .elf files but gains the ability to decode macros
DEBUG_FLAGS ?= -ggdb3
# Launch with "make Q=''" to get full command display
Q=@
CFLAGS = -W -Wall
CFLAGS += $(INCLUDES)
CFLAGS += $($(TARGET).CFLAGS)
CFLAGS += $(USER_CFLAGS)
CFLAGS += -O$(OPT)
CFLAGS += $(DEBUG_FLAGS)
CFLAGS += -std=gnu99
CFLAGS += $(shell pkg-config --cflags-only-I ivy-glib)
CXXFLAGS = -W -Wall
CXXFLAGS += $(INCLUDES)
CXXFLAGS += $($(TARGET).CFLAGS)
CXXFLAGS += $(USER_CFLAGS)
CXXFLAGS += -O$(OPT)
CXXFLAGS += $(DEBUG_FLAGS)
CXXFLAGS += $(shell pkg-config --cflags-only-I ivy-glib)
LDFLAGS += $($(TARGET).LDFLAGS)
#
# General rules
#
$(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
$(TARGET).objso = $($(TARGET).srcs:%.c=$(OBJDIR)/%.o)
$(TARGET).objsoxx = $($(TARGET).objso:%.cpp=$(OBJDIR)/%.o)
$(TARGET).objs = $($(TARGET).objsoxx:%.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)$(CXX) $(CXXFLAGS) -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 CXX $@
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -S -o $@ $<
$(OBJDIR)/%.o: %.c $(OBJDIR)/../Makefile.ac
@echo CC $@
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
$(Q)$(CC) -MMD $(CFLAGS) -c -o $@ $<
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac
@echo CXX $@
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
$(Q)$(CXX) -MMD $(CXXFLAGS) -c -o $@ $<
.PHONY: all compile check_jsbsim
#
# Dependencies
#
ifneq ($(MAKECMDGOALS),clean)
DEPS = $(addprefix $(OBJDIR)/,$($(TARGET).srcs:.c=.d))
DEPS += $(addprefix $(OBJDIR)/,$($(TARGET).srcs:.cpp=.d))
-include $(DEPS)
endif