.EXPORT_ALL_VARIABLES: # A directory we use to hold various miscellaneous stuff NEC_COMMON = $(ROOTDIR)/vendors/NEC/common ############################################################################ # # The makefiles need to know how to do things in different contexts # To save some pain we put it all here # # First settings we always want for all build # CC = $(CROSS_COMPILE)gcc AS = $(CROSS_COMPILE)as CXX = $(CROSS_COMPILE)g++ AR = $(CROSS_COMPILE)ar LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy RANLIB = $(CROSS_COMPILE)ranlib ELF2FLT = elf2flt STRIPTOOL = $(CROSS_COMPILE)strip STRIP = $(STRIPTOOL) UCLINUX_BUILD_SET = 0 # have we set a special config below ############################################################################ # # General purpose lib building rules, uClibc.config uses these when # possible # ifdef UCLINUX_BUILD_LIB ifdef CONFIG_LIB_DEBUG CFLAGS := -O2 -g else CFLAGS := -O2 -g -fomit-frame-pointer endif CFLAGS += $(VENDOR_CFLAGS) # don't want all the CFLAGS for uClibc/Config ARCH_CFLAGS = $(CFLAGS) CFLAGS += -I$(ROOTDIR)/lib/$(CONFIG_LIBCDIR)/include -I$(ROOTDIR) CFLAGS += -Dlinux -D__linux__ -D__uClinux__ -Dunix UCLINUX_BUILD_SET=1 endif ############################################################################ # # Settings for building user apps # ifdef UCLINUX_BUILD_USER # Note that we assume the use of uClibc, instead of uC-libc, # because uC-libc absolutely will not work for the v850. # Use our `flatgcc' wrapper, which in turn invokes uClibc's gcc # wrapper, which then invokes gcc (whew!). The option # `--uclibc-use-build-dir' tells uClibc's wrapper that it should # use the uClibc build directory to find libraries, etc. # Our gcc wrapper script FLATGCC = $(NEC_COMMON)/flatgcc # The uClibc wrapper that flatgcc calls; this variable is # interpreted directly by flatgcc (as an environment variable). FLATGCC_CC = $(ROOTDIR)/uClibc/extra/gcc-uClibc/$(ARCH)-uclibc-gcc DEFAULT_ELF2FLT_LINKER_SCRIPTS = $(NEC_COMMON)/$(MACHINE)/elf2flt.ld \ $(NEC_COMMON)/$(ARCH)/elf2flt.ld \ $(NEC_COMMON)/elf2flt.ld # Make an attempt to find the linker script that should be used # for elf2flt inputs. If we can't find one, we fall back to our # own copy, $(DEFAULT_ELF2FLT_LINKER_SCRIPT). ELF2FLT_SEARCH_BINARY = elf2flt ELF2FLT_SEARCH_LINKER_SCRIPT = elf2flt.ld ELF2FLT_LOC := $(dir $(firstword $(wildcard $(addsuffix /$(ELF2FLT_SEARCH_BINARY),$(subst :, ,$(PATH)))))) ELF2FLT_LINKER_SCRIPT := $(firstword $(wildcard $(addsuffix $(ELF2FLT_SEARCH_LINKER_SCRIPT),$(patsubst %/bin/,%/lib/,$(ELF2FLT_LOC))) $(DEFAULT_ELF2FLT_LINKER_SCRIPTS))) CC = $(FLATGCC) --uclibc-use-build-dir -T$(ELF2FLT_LINKER_SCRIPT) # Passed to elf2flt by flatgcc FLTFLAGS := LIBM = -lm LIBNET = -lnet LIBDES = -ldes LIBPCAP = -lpcap LIBSSL = -lssl LIBCRYPTO = -lcrypto LIBCRYPT = -lcrypt LIBGCC = -lgcc LIBIBERTY = -liberty LIBIO = -lio LIBIOSTREAM = -liostream LIBSTDCPP = -lstdc++ LIBTERMCAP = -lg LDPATH = \ -L$(ROOTDIR)/lib/libnet \ -L$(ROOTDIR)/lib/libdes \ -L$(ROOTDIR)/lib/libpcap \ -L$(ROOTDIR)/lib/libg \ -L$(ROOTDIR)/lib/libssl INCNET = -I$(ROOTDIR)/lib/libnet INCDES = -I$(ROOTDIR)/freeswan/libdes INCGMP = -I$(ROOTDIR)/lib/libgmp INCPCAP = -I$(ROOTDIR)/lib/libpcap INCSSL = -I$(ROOTDIR)/lib/libssl/include ifdef CONFIG_USER_DEBUG CFLAGS := -Os -g else CFLAGS := -Os -g -fomit-frame-pointer endif CFLAGS += $(VENDOR_CFLAGS) CFLAGS += -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED CFLAGS += -I$(ROOTDIR) CXXFLAGS = $(CFLAGS) $(INCCXX) -fname-mangling-version-0 LDFLAGS = $(CFLAGS) # we use `flatgcc' LDLIBS = $(LDPATH) $(LIBC) CXXLIBS = $(LDPATH) $(LIBSTDCPP) $(LIBIOSTREAM) $(LIBIO) $(LIBIBERTY) UCLINUX_BUILD_SET=1 endif ############################################################################ # # fall through, do other config options perhaps # ifeq ($(UCLINUX_BUILD_SET),1) endif # This is a hack to setup the libc config file ifeq ($(UCLINUX_BUILD_LIB)+$(findstring uClibc,$(LIBCDIR)),1+uClibc) all: uClibc/.config uClibc/.config: $(VENDDIR)/config.uClibc cp $? $@ endif ############################################################################