Skip to content

Commit

Permalink
[build_system] removing duplicates for all airborne targets should wo…
Browse files Browse the repository at this point in the history
…rk now.

pkg-config and the like need to be expanded via $(shell instead of using backquotes.
No spaces between -I and dir for generated module includes"
  • Loading branch information
flixr committed Jan 17, 2013
1 parent 1470319 commit 51accc5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
4 changes: 2 additions & 2 deletions conf/firmwares/subsystems/fixedwing/autopilot.makefile
Expand Up @@ -219,8 +219,8 @@ jsbsim.CFLAGS += -DSITL
jsbsim.srcs += $(SIMDIR)/sim_ac_jsbsim.c $(SIMDIR)/sim_ac_fw.c $(SIMDIR)/sim_ac_flightgear.c

# external libraries
jsbsim.CFLAGS += -I$(SIMDIR) -I/usr/include -I$(JSBSIM_INC) -I$(OCAMLLIBDIR) `pkg-config glib-2.0 --cflags`
jsbsim.LDFLAGS += `pkg-config glib-2.0 --libs` -lglibivy -lm -L/usr/lib -lJSBSim
jsbsim.CFLAGS += -I$(SIMDIR) -I/usr/include -I$(JSBSIM_INC) -I$(OCAMLLIBDIR) $(shell pkg-config glib-2.0 --cflags)
jsbsim.LDFLAGS += $(shell pkg-config glib-2.0 --libs) -lglibivy -lm -L/usr/lib -lJSBSim

jsbsim.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport
jsbsim.srcs += subsystems/datalink/downlink.c $(SRC_FIRMWARE)/datalink.c $(SRC_ARCH)/jsbsim_hw.c $(SRC_ARCH)/jsbsim_ir.c $(SRC_ARCH)/jsbsim_gps.c $(SRC_ARCH)/jsbsim_ahrs.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/jsbsim_transport.c
Expand Down
10 changes: 5 additions & 5 deletions conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile
Expand Up @@ -21,18 +21,18 @@ nps.ARCHDIR = 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
nps.CFLAGS += $(shell pkg-config glib-2.0 --cflags)
nps.LDFLAGS += $(shell pkg-config glib-2.0 --libs) -lm -lglibivy -lgsl -lgslcblas
nps.CFLAGS += -I$(NPSDIR) -I$(SRC_FIRMWARE) -I$(SRC_BOARD) -I../simulator -I$(PAPARAZZI_HOME)/conf/simulator/nps
nps.LDFLAGS += `sdl-config --libs`
nps.LDFLAGS += $(shell sdl-config --libs)

# use the paparazzi-jsbsim package if it is installed, otherwise look for JSBsim under /opt/jsbsim
ifndef JSBSIM_PKG
JSBSIM_PKG = $(shell pkg-config JSBSim --exists && echo 'yes')
endif
ifeq ($(JSBSIM_PKG), yes)
nps.CFLAGS += `pkg-config JSBSim --cflags`
nps.LDFLAGS += `pkg-config JSBSim --libs`
nps.CFLAGS += $(shell pkg-config JSBSim --cflags)
nps.LDFLAGS += $(shell pkg-config JSBSim --libs)
else
JSBSIM_PKG = no
nps.CFLAGS += -I$(JSBSIM_INC)
Expand Down
9 changes: 9 additions & 0 deletions sw/airborne/Makefile
Expand Up @@ -44,6 +44,15 @@ ifneq ($(MAKECMDGOALS),clean)
include ../../conf/Makefile.$($(TARGET).ARCHDIR)
endif
endif

# sort cflags and sources to throw out duplicates
#
#$(info CFLAGS_orig = $($(TARGET).CFLAGS))
#$(info CFLAGS_sort = $(sort $($(TARGET).CFLAGS)))
#$(info srcs_orig = $($(TARGET).srcs))
#$(info srcs_sort = $(sort $($(TARGET).srcs)))
$(TARGET).CFLAGS := $(sort $($(TARGET).CFLAGS))
$(TARGET).srcs := $(sort $($(TARGET).srcs))
endif

# check for obsolete MODEM_UART_NR and GPS_UART_NR makefile vars
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/fms/Makefile
@@ -1,6 +1,6 @@

CFLAGS = -Wall `pkg-config --cflags glib-2.0` -g
LDFLAGS = `pkg-config --libs glib-2.0`
CFLAGS = -Wall $(shell pkg-config --cflags glib-2.0) -g
LDFLAGS = $(shell pkg-config --libs glib-2.0)

fms: fms_main.c fms_ap_link.c fms_serial_port.c fms_gs_link.c fms_network.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
Expand Down
4 changes: 2 additions & 2 deletions sw/airborne/test/ahrs/Makefile
Expand Up @@ -145,8 +145,8 @@ run_ahrs_on_synth: run_ahrs_on_synth.c $(RAOS_SRCS) $(AHRS_SRCS)
@echo "Building run_ahrs_on_synth for $(AHRS_TYPE)"
$(Q) $(CC) $(CFLAGS) $(AHRS_CFLAGS) -o $@ $^ $(LDFLAGS)

IVY_CFLAGS=-g -O2 -Wall `pkg-config glib-2.0 --cflags`
IVY_LDFLAGS=`pkg-config glib-2.0 --libs` -lglibivy
IVY_CFLAGS=-g -O2 -Wall $(shell pkg-config glib-2.0 --cflags)
IVY_LDFLAGS=$(shell pkg-config glib-2.0 --libs) -lglibivy

run_ahrs_on_synth_ivy: run_ahrs_on_synth_ivy.c $(RAOS_SRCS) $(AHRS_SRCS)
$(CC) $(CFLAGS) $(AHRS_CFLAGS) $(IVY_CFLAGS) -o $@ $^ $(LDFLAGS) $(IVY_LDFLAGS)
Expand Down
4 changes: 2 additions & 2 deletions sw/tools/gen_aircraft.ml
Expand Up @@ -84,10 +84,10 @@ let dump_module_section = fun xml f ->
let dir_list = Gen_common.get_modules_dir modules in
(**
let target_list = union_of_lists (List.map (fun (m,_) -> get_targets_of_module m) modules) in
List.iter (fun target -> fprintf f "%s.CFLAGS += -I modules -I arch/$(ARCH)/modules\n" target) target_list;
List.iter (fun target -> fprintf f "%s.CFLAGS += -Imodules -Iarch/$(ARCH)/modules\n" target) target_list;
**)
(** include modules directory for ALL targets and not just the defined ones **)
fprintf f "$(TARGET).CFLAGS += -I modules -I arch/$(ARCH)/modules\n";
fprintf f "$(TARGET).CFLAGS += -Imodules -Iarch/$(ARCH)/modules\n";
List.iter (fun dir -> let dir_name = (String.uppercase dir)^"_DIR" in fprintf f "%s = modules/%s\n" dir_name dir) dir_list;
(* parse each module *)
List.iter (fun m ->
Expand Down

0 comments on commit 51accc5

Please sign in to comment.