diff --git a/conf/Makefile.chibios-libopencm3 b/conf/Makefile.chibios-libopencm3 index d3b9ec0c82..e281206da7 100644 --- a/conf/Makefile.chibios-libopencm3 +++ b/conf/Makefile.chibios-libopencm3 @@ -283,7 +283,7 @@ DLIBS = -lm -lopencm3_stm32f4 # # List all user C define here, like -D_DEBUG=1 -UDEFS = $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) -DUSE_OCM3_SYSTICK_INIT=0 +UDEFS = $($(TARGET).CFLAGS) $(USER_CFLAGS) -DUSE_OCM3_SYSTICK_INIT=0 # Define ASM defines here UADEFS = diff --git a/conf/Makefile.geode b/conf/Makefile.geode index dedaabf443..ce38405faa 100644 --- a/conf/Makefile.geode +++ b/conf/Makefile.geode @@ -46,7 +46,7 @@ CFLAGS += -mtune=geode # optimize for geode CFLAGS + = -Wstrict-prototypes -Wmissing-declarations CFLAGS += -Wmissing-prototypes -Wnested-externs CFLAGS += $(CSTANDARD) -CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) +CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS) #Additional libraries. MATH_LIB = -lm diff --git a/conf/Makefile.jsbsim b/conf/Makefile.jsbsim index 04044e7c27..b9dba82d4a 100644 --- a/conf/Makefile.jsbsim +++ b/conf/Makefile.jsbsim @@ -38,7 +38,7 @@ Q=@ # Compilation flags # -CFLAGS = -W -Wall $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/airborne/$(SRC_ARCH) $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) -O$(OPT) +CFLAGS = -W -Wall $(INCLUDES) -I$(PAPARAZZI_SRC)/sw/airborne/$(SRC_ARCH) $($(TARGET).CFLAGS) $(USER_CFLAGS) -O$(OPT) LDFLAGS = -lm $($(TARGET).LDFLAGS) diff --git a/conf/Makefile.lpc21 b/conf/Makefile.lpc21 index 473f0e06c6..117cf4607e 100644 --- a/conf/Makefile.lpc21 +++ b/conf/Makefile.lpc21 @@ -96,7 +96,7 @@ CFLAGS += -Wshadow CFLAGS += -Wnested-externs CFLAGS += $(CSTANDARD) -CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) +CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS) # Assembler flags. ASFLAGS = -Wa,-adhlns=$(OBJDIR)/$(notdir $(<:.S=.lst)) diff --git a/conf/Makefile.nps b/conf/Makefile.nps index 8e1d50063d..ca309ef70a 100644 --- a/conf/Makefile.nps +++ b/conf/Makefile.nps @@ -35,7 +35,7 @@ Q=@ CFLAGS = -W -Wall CFLAGS += $(INCLUDES) CFLAGS += $($(TARGET).CFLAGS) -CFLAGS += $(LOCAL_CFLAGS) +CFLAGS += $(USER_CFLAGS) CFLAGS += -O$(OPT) CFLAGS += -g CFLAGS += -std=gnu99 @@ -44,7 +44,7 @@ CFLAGS += $(shell pkg-config --cflags-only-I ivy-glib) CXXFLAGS = -W -Wall CXXFLAGS += $(INCLUDES) CXXFLAGS += $($(TARGET).CFLAGS) -CXXFLAGS += $(LOCAL_CFLAGS) +CXXFLAGS += $(USER_CFLAGS) CXXFLAGS += -O$(OPT) CXXFLAGS += -g CXXFLAGS += $(shell pkg-config --cflags-only-I ivy-glib) diff --git a/conf/Makefile.omap b/conf/Makefile.omap index 4e5fedcc8c..7b2e049a84 100644 --- a/conf/Makefile.omap +++ b/conf/Makefile.omap @@ -54,6 +54,7 @@ CFLAGS += -Wstrict-prototypes -Wmissing-declarations CFLAGS += -Wmissing-prototypes -Wnested-externs CFLAGS += $(CSTANDARD) CFLAGS += $($(TARGET).CFLAGS) +CFLAGS += $(USER_CFLAGS) LDFLAGS += -lm @@ -62,6 +63,7 @@ CXXFLAGS += -g -ffunction-sections -fdata-sections CXXFLAGS += -mfloat-abi=softfp -mtune=cortex-a8 -mfpu=vfp -march=armv7-a CXXFLAGS += -Wall -Wextra CXXFLAGS += $($(TARGET).CXXFLAGS) +CXXFLAGS += $(USER_CFLAGS) SRC_C_OMAP = $($(TARGET).srcs) OBJ_C_OMAP = $(SRC_C_OMAP:%.c=$(OBJDIR)/%.o) diff --git a/conf/Makefile.pentium-m b/conf/Makefile.pentium-m index 39793920df..ed9ee530d4 100644 --- a/conf/Makefile.pentium-m +++ b/conf/Makefile.pentium-m @@ -55,7 +55,7 @@ CFLAGS += -m32 CFLAGS += -Wstrict-prototypes -Wmissing-declarations CFLAGS += -Wmissing-prototypes -Wnested-externs CFLAGS += $(CSTANDARD) -CFLAGS += $($(TARGET).CFLAGS) $(LOCAL_CFLAGS) +CFLAGS += $($(TARGET).CFLAGS) $(USER_CFLAGS) #Additional libraries. MATH_LIB = -lm diff --git a/conf/Makefile.sim b/conf/Makefile.sim index b9cf412d4f..a6dbae0e19 100644 --- a/conf/Makefile.sim +++ b/conf/Makefile.sim @@ -51,7 +51,7 @@ INCLUDES += -I $(shell $(OCAMLC) -where) CFLAGS = -W -Wall CFLAGS += $(INCLUDES) CFLAGS += $($(TARGET).CFLAGS) -CFLAGS += $(LOCAL_CFLAGS) +CFLAGS += $(USER_CFLAGS) CFLAGS += -fPIC CFLAGS += -O$(OPT) CFLAGS += -g diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index 857d31941e..44e4feb67a 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -102,6 +102,8 @@ CFLAGS += -Wstrict-prototypes -Wmissing-prototypes CFLAGS += -Wshadow CFLAGS += -Wnested-externs +CFLAGS += $(USER_CFLAGS) + #CFLAGS += -fno-diagnostics-show-caret ifneq ($(ARCH_L), ) diff --git a/tests/examples/01_compile_all_test_targets.t b/tests/examples/01_compile_all_aircrafts.t similarity index 55% rename from tests/examples/01_compile_all_test_targets.t rename to tests/examples/01_compile_all_aircrafts.t index 4fcff50f08..9c14937f01 100644 --- a/tests/examples/01_compile_all_test_targets.t +++ b/tests/examples/01_compile_all_aircrafts.t @@ -1,5 +1,24 @@ #!/usr/bin/perl -w +# +# Reads conf/conf.xml (can be symlink to e.g. conf/conf_tests.xml) +# and compiles all targets of all aircrafts. +# +# Mandatory environment variables: +# PAPARAZZI_SRC : path to paparazzi source directory +# PAPARAZZI_HOME : path to paparazz home directory containing the conf +# +# optional environment variables: +# TEST_VERBOSE : set to 1 to print the compile output even if there was no error +# +# environment variables passed on to make: +# J=AUTO : detect number of CPUs to set jobs for parallel compilation +# +# Example on how to test compile all aircrafts/targets in your current conf.xml +# with parallel compilation and treating all warnings as errors: +# J=AUTO USER_CFLAGS=-Werror prove tests/examples +# + use Test::More; use lib "$ENV{'PAPARAZZI_SRC'}/tests/lib"; use XML::Simple; @@ -9,28 +28,28 @@ use Config; $|++; my $xmlSimple = XML::Simple->new(ForceArray => 1); -my $examples = $xmlSimple->XMLin("$ENV{'PAPARAZZI_SRC'}/conf/conf.xml"); +my $conf = $xmlSimple->XMLin("$ENV{'PAPARAZZI_HOME'}/conf/conf.xml"); -ok(1, "Parsed the tests configuration file"); -foreach my $example (sort keys%{$examples->{'aircraft'}}) +ok(1, "Parsed the configuration file"); +foreach my $aircraft (sort keys%{$conf->{'aircraft'}}) { - my $airframe = $examples->{'aircraft'}->{$example}->{'airframe'}; - my $airframe_config = $xmlSimple->XMLin("$ENV{'PAPARAZZI_SRC'}/conf/$airframe"); + my $airframe = $conf->{'aircraft'}->{$aircraft}->{'airframe'}; + my $airframe_config = $xmlSimple->XMLin("$ENV{'PAPARAZZI_HOME'}/conf/$airframe"); foreach my $process (sort keys %{$airframe_config->{'firmware'}}) { - #warn "EX: [$example] ". Dumper($airframe_config->{'firmware'}->{$process}->{'target'}); + #warn "EX: [$aircraft] ". Dumper($airframe_config->{'firmware'}->{$process}->{'target'}); foreach my $target (sort keys %{$airframe_config->{'firmware'}->{$process}->{'target'}}) { - #warn "EXAMPLE: [$example] TARGET: [$target]\n"; - my $make_options = "AIRCRAFT=$example clean_ac $target.compile"; + #warn "AIRCRAFT: [$aircraft] TARGET: [$target]\n"; + my $make_options = "AIRCRAFT=$aircraft clean_ac $target.compile"; my ($exit_status, $output) = run_program( - "Attempting to build the firmware $target for the aircraft $example.", + "Attempting to build the firmware $target for the aircraft $aircraft.", $ENV{'PAPARAZZI_SRC'}, "make $make_options", $ENV{'TEST_VERBOSE'},1); # print output if it failed and we didn't already print it in verbose mode warn "$output\n" if $exit_status && !$ENV{'TEST_VERBOSE'}; - ok($exit_status == 0, "Compile aircraft: $example, target: $target"); + ok($exit_status == 0, "Compile aircraft: $aircraft, target: $target"); } } } @@ -68,13 +87,14 @@ sub run_program my $exit_status = $?/256; unless ($exit_status == 0) { + my $err_msg = "\nError: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n"; if ($dont_fail_on_error) { - warn "\nError: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n"; + warn $err_msg; } else { - die "\nError: The command \"". $prog->last_command() ."\" failed to complete successfully. Exit status: $exit_status\n"; + die $err_msg; } } my $output_string = join "\n", @output;