From 3865746d3c0db2978134470fde6cfcd734abfef7 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期六, 10 十月 2020 16:42:59 +0800 Subject: [PATCH] update --- Make.defines.linux | 63 ++++++++++++++++++++++++------- 1 files changed, 49 insertions(+), 14 deletions(-) diff --git a/Make.defines.linux b/Make.defines.linux index 9e30018..2a1fddc 100755 --- a/Make.defines.linux +++ b/Make.defines.linux @@ -1,33 +1,68 @@ # Common make definitions, customized for each platform + + +# Cross-compiler jos toolchain +# +# This Makefile will automatically use the cross-compiler toolchain +# installed as 'i386-jos-elf-*', if one exists. If the host tools ('gcc', +# 'objdump', and so forth) compile for a 32-bit x86 ELF target, that will +# be detected as well. If you have the right compiler toolchain installed +# using a different name, set GCCPREFIX explicitly in conf/env.mk + +# try to infer the correct GCCPREFIX +ifndef GCCPREFIX +GCCPREFIX := $(shell if i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \ + then echo 'i386-jos-elf-'; \ + elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \ + then echo ''; \ + else echo "***" 1>&2; \ + echo "*** Error: Couldn't find an i386-*-elf version of GCC/binutils." 1>&2; \ + echo "*** Is the directory with i386-jos-elf-gcc in your PATH?" 1>&2; \ + echo "*** If your i386-*-elf toolchain is installed with a command" 1>&2; \ + echo "*** prefix other than 'i386-jos-elf-', set your GCCPREFIX" 1>&2; \ + echo "*** environment variable to that prefix and run 'make' again." 1>&2; \ + echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \ + echo "***" 1>&2; exit 1; fi) +endif + # Definitions required in all program directories to compile and link # C programs using gcc. DEBUG=y CC = g++ -COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c -LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -LDFLAGS= +# COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c +# LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) + +# preprocessor options +CPPFLAGS += $(INCLUDES) -std=c++11 +# compilation options +CFLAGS += $(DEBUGFLAGS) -Wall -DLINUX -D_GNU_SOURCE $(EXTRA) +# linked options +LDFLAGS += + + LDDIR += -L$(ROOT)/lib -LDLIBS += $(LDDIR) $(EXTRALIBS) -INCLUDE += -I. -I./include -I$(ROOT)/include -I$(ROOT)/include/usgcommon +LDLIBS += $(RPATH) $(LDDIR) $(EXTRALIBS) + +INCLUDES += -I. -I./include -I$(ROOT)/include + +DEST=$(ROOT)/build +# DEST=. ifeq ($(DEBUG),y) - DEBFLAGS = -O -g # "-O" is needed to expand inlines + DEBUGFLAGS = -O -g # "-O" is needed to expand inlines else - DEBFLAGS = -O2 + DEBUGFLAGS = -O2 endif -CFLAGS += $(INCLUDE) $(DEBFLAGS) -mcx16 -std=c++11 -Wall -DLINUX -D_GNU_SOURCE $(EXTRA) + + RANLIB=echo AR=ar AWK=awk -#LIBCOMMON=$(ROOT)/common/libusgcommon.a - +NM := $(GCCPREFIX)nm # Common temp files to delete from each directory. -TEMPFILES=core core.* **/*.o temp.* *.out *.a *.so - -%: %.c - $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS) +TEMPFILES=core core.* *.o temp.* *.out *.a *.so *.sym -- Gitblit v1.8.0