> On Nov 15, 2016, at 10:55 PM, Khem Raj <raj.k...@gmail.com> wrote: > > > > On 11/15/16 8:56 PM, Jianxun Zhang wrote: >> Add detection of current path for -I option, also update >> type definitions for EFI compiling. >> >> Signed-off-by: Jianxun Zhang <jianxun.zh...@linux.intel.com> >> --- >> Makefile | 4 +++- >> Makefile.efi | 4 +++- >> inc/rmc_types.h | 9 ++++++--- >> 3 files changed, 12 insertions(+), 5 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index f152829..6c68a51 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -1,5 +1,7 @@ >> # Copyright (C) 2016 Jianxun Zhang <jianxun.zh...@intel.com> >> >> +TOPDIR = $(shell if [ -z "$$PWD" ]; then pwd; else echo "$$PWD"; fi) >> + >> RMC_TOOL_SRC := $(wildcard src/*.c) >> RMC_TOOL_OBJ := $(patsubst %.c,%.o,$(RMC_TOOL_SRC)) >> >> @@ -17,7 +19,7 @@ RMC_INSTALL_BIN_PATH := $(RMC_INSTALL_PREFIX)/bin/ >> >> ALL_OBJS := $(RMC_TOOL_OBJ) $(RMCL_OBJ) $(RSMP_OBJ) >> >> -CFLAGS := -Wall -O2 -Iinc $(RMC_CFLAGS) >> +CFLAGS := -Wall -O2 -I$(TOPDIR)/inc $(RMC_CFLAGS) >> >> all: rmc librmcl librsmp >> >> diff --git a/Makefile.efi b/Makefile.efi >> index 4c2aada..2af85cb 100644 >> --- a/Makefile.efi >> +++ b/Makefile.efi >> @@ -1,5 +1,7 @@ >> # Copyright (C) 2016 Jianxun Zhang <jianxun.zh...@intel.com> >> >> +TOPDIR = $(shell if [ -z "$$PWD" ]; then pwd; else echo "$$PWD"; fi) >> + >> RMCL_SRC :=$(wildcard src/rmcl/*.c) >> RMCL_OBJ := $(patsubst %.c,%.efi.o,$(RMCL_SRC)) >> >> @@ -34,7 +36,7 @@ RMC_INSTALL_LIBS_PATH := $(RMC_INSTALL_PREFIX)/lib/ >> SHARED_OBJS := src/util/util.efi.o >> ALL_OBJS := $(RMCL_OBJ) $(RSMP_OBJ) $(SHARED_OBJS) >> >> -CFLAGS := -DRMC_EFI -Wall -O2 -Iinc -fpic -nostdinc -nostdlib -fno-builtin >> -std=gnu90 \ >> +CFLAGS := -DRMC_EFI -Wall -O2 -I$(TOPDIR)/inc -fpic -nostdinc -nostdlib >> -fno-builtin -std=gnu90 \ >> -I$(RMC_EFI_HEADER_PREFIX) >> -I$(RMC_EFI_HEADER_PREFIX)/$(RMC_EFI_ARCH) $(RMC_CFLAGS) > > while this patch improves the situation. It would be better if the package > would respect the flags coming from environment and not ignore them as it is > doing here and then synthesizing stuff. Are there other compile scenarios > where its compiled for non-linux targets as well ? when will > RMC_EFI_HEADER_PREFIX not look into sysroot ? > If I understand the suggestion correctly, we should not override CFLAGS but perhaps use the local RMC_CFLAGS to hold special options here, then pass them together to compiler.
I don’t see a non-linux use case so far. The header files we need can be installed out of sysroot because their package provides that option in linux. These variables work for these non-typical use cases. Most of C flags in this Makefile are to resolve specific issues. Some of left over from prototype stage, like -O2, should be removed from the internal flags. I will address these other issues in a coming bigger refactor work that's already in progress on top of this change. > if this makefile was accomodating the environment then bitbake rightly sets up > CFLAGS for cross compiling. > >> >> all: librmclefi librsmpefi >> diff --git a/inc/rmc_types.h b/inc/rmc_types.h >> index b6e4521..9154231 100644 >> --- a/inc/rmc_types.h >> +++ b/inc/rmc_types.h >> @@ -7,14 +7,17 @@ >> #define INC_RMC_TYPES_H_ >> >> #ifndef RMC_EFI >> +#include <sys/types.h> >> #include <stdint.h> >> #include <stddef.h> >> #include <string.h> >> #else >> #include <efi.h> >> -/* Fixme: we define (s)size_t here for both 32 and 64 bit because gnu-efi >> doesn't provide these */ >> -typedef uint64_t size_t; >> -typedef uint64_t ssize_t; >> +/* we specify -nostdinc in C flag and provide these in rmc >> + * for EFI applications that don't want to use standard headers. >> + */ >> +typedef unsigned long size_t; >> +typedef long ssize_t; >> #endif >> >> typedef uint8_t BYTE; >> > -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto