diff options
Diffstat (limited to 'gcc/ada/bld.adb')
-rw-r--r-- | gcc/ada/bld.adb | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/gcc/ada/bld.adb b/gcc/ada/bld.adb index a86f299..fef76a0 100644 --- a/gcc/ada/bld.adb +++ b/gcc/ada/bld.adb @@ -222,6 +222,7 @@ package body Bld is Deps_Projects_String : aliased String := "DEPS_PROJECT"; Exec_String : aliased String := "EXEC"; Exec_Dir_String : aliased String := "EXEC_DIR"; + Fldflags_String : aliased String := "FLDFLAGS"; Gnatmake_String : aliased String := "GNATMAKE"; Languages_String : aliased String := "LANGUAGES"; Ld_Flags_String : aliased String := "LD_FLAGS"; @@ -251,6 +252,7 @@ package body Bld is Deps_Projects_String'Access, Exec_String 'Access, Exec_Dir_String 'Access, + Fldflags_String 'Access, Gnatmake_String 'Access, Languages_String 'Access, Ld_Flags_String 'Access, @@ -1426,7 +1428,8 @@ package body Bld is (Pkg = No_Name or else Pkg = Snames.Name_Naming or else Pkg = Snames.Name_Compiler - or else Pkg = Name_Ide); + or else Pkg = Name_Ide + or else Pkg = Snames.Name_Linker); if Put_Declaration then -- Some attributes are converted into reserved variables @@ -1508,7 +1511,7 @@ package body Bld is Put_Attribute (Project, Pkg, Item_Name, No_Name); Put ("),$(shell gprcmd extend $("); Put (Project_Name); - Put_Line (".base_dir) '$(name)'))"); + Put_Line (".base_dir) '""$(name)""'))"); elsif Item_Name = Snames.Name_Source_Files then @@ -1959,6 +1962,38 @@ package body Bld is end if; end if; end; + + else + -- Other attribute are of no interest; suppress + -- their declarations. + + Put_Declaration := False; + end if; + + elsif Pkg = Snames.Name_Linker then + if Item_Name = Snames.Name_Linker_Options then + -- Only add linker options if this is not the root + -- project. + + Put ("ifeq ($("); + Put (Project_Name); + Put (".root),False)"); + New_Line; + + -- Add the linker options to FLDFLAGS, in reverse + -- order. + + Put (" FLDFLAGS:=$(shell gprcmd linkopts $("); + Put (Project_Name); + Put (".base_dir) $("); + Put_Attribute + (Project, Pkg, Item_Name, No_Name); + Put (")) $(FLDFLAGS)"); + New_Line; + + Put ("endif"); + New_Line; + else -- Other attribute are of no interest; suppress -- their declarations. @@ -2686,6 +2721,15 @@ package body Bld is -- Set defaults to some variables + -- CFLAGS and CXXFLAGS are set by default to nothing. + -- Their initial values have been saved, If they are not set + -- by this project file, then they will be reset to their + -- initial values. This is to avoid "inheritance" of these + -- flags from an imported project file. + + Put_Line ("CFLAGS:="); + Put_Line ("CXXFLAGS:="); + IO.Mark (Src_Files_Init); Put_Line ("src_files.specified:=FALSE"); @@ -3345,6 +3389,19 @@ package body Bld is end if; end; + -- If CFLAGS/CXXFLAGS have not been set, set them back to + -- their initial values. + + Put_Line ("ifeq ($(CFLAGS),)"); + Put_Line (" CFLAGS:=$(CFLAGS.saved)"); + Put_Line ("endif"); + New_Line; + + Put_Line ("ifeq ($(CXXFLAGS),)"); + Put_Line (" CXXFLAGS:=$(CXXFLAGS.saved)"); + Put_Line ("endif"); + New_Line; + -- If this is the main Makefile, include Makefile.Generic Put ("ifeq ($("); |