Introduce CPP_FOR_TARGET in Makefile

This commit is contained in:
Florian Zeitz 2012-02-28 12:48:25 +01:00
parent 5b5139c283
commit f58afd7e34

View file

@ -1,45 +1,46 @@
TOPDIR = $(shell pwd) TOPDIR := $(shell pwd)
ARCH = x86 ARCH = x86
NAME = metalsvm NAME = metalsvm
LWIPDIRS = lwip/src/arch lwip/src/api lwip/src/core lwip/src/core/ipv4 lwip/src/netif LWIPDIRS = lwip/src/arch lwip/src/api lwip/src/core lwip/src/core/ipv4 lwip/src/netif
DRIVERDIRS = drivers/net drivers/char DRIVERDIRS = drivers/net drivers/char
KERNDIRS = libkern kernel mm fs apps arch/$(ARCH)/kernel arch/$(ARCH)/mm arch/$(ARCH)/scc $(LWIPDIRS) $(DRIVERDIRS) KERNDIRS = libkern kernel mm fs apps arch/$(ARCH)/kernel arch/$(ARCH)/mm arch/$(ARCH)/scc $(LWIPDIRS) $(DRIVERDIRS)
SUBDIRS = $(KERNDIRS) SUBDIRS = $(KERNDIRS)
STACKPROT=-fno-stack-protector STACKPROT = -fno-stack-protector
# Set your own cross compiler tool chain prefix here # Set your own cross compiler tool chain prefix here
CROSSCOMPREFIX= CROSSCOMPREFIX =
# Uncomment both lines if compiling for the SCC! # Uncomment both lines if compiling for the SCC!
#CROSSCOMPREFIX=i386-unknown-linux-gnu- #CROSSCOMPREFIX = i386-unknown-linux-gnu-
#STACKPROT= #STACKPROT =
CC_FOR_TARGET=$(CROSSCOMPREFIX)gcc CC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
CXX_FOR_TARGET=$(CROSSCOMPREFIX)g++ CXX_FOR_TARGET = $(CROSSCOMPREFIX)g++
GCC_FOR_TARGET=$(CROSSCOMPREFIX)gcc GCC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
AR_FOR_TARGET=$(CROSSCOMPREFIX)ar CPP_FOR_TARGET = $(CROSSCOMPREFIX)cpp
AS_FOR_TARGET=$(CROSSCOMPREFIX)as AR_FOR_TARGET = $(CROSSCOMPREFIX)ar
LD_FOR_TARGET=$(CROSSCOMPREFIX)ld AS_FOR_TARGET = $(CROSSCOMPREFIX)as
NM_FOR_TARGET=$(CROSSCOMPREFIX)nm LD_FOR_TARGET = $(CROSSCOMPREFIX)ld
OBJDUMP_FOR_TARGET=$(CROSSCOMPREFIX)objdump NM_FOR_TARGET = $(CROSSCOMPREFIX)nm
OBJCOPY_FOR_TARGET=$(CROSSCOMPREFIX)objcopy OBJDUMP_FOR_TARGET = $(CROSSCOMPREFIX)objdump
RANLIB_FOR_TARGET=$(CROSSCOMPREFIX)ranlib OBJCOPY_FOR_TARGET = $(CROSSCOMPREFIX)objcopy
STRIP_FOR_TARGET=$(CROSSCOMPREFIX)strip RANLIB_FOR_TARGET = $(CROSSCOMPREFIX)ranlib
READELF_FOR_TARGET=$(CROSSCOMPREFIX)readelf STRIP_FOR_TARGET = $(CROSSCOMPREFIX)strip
READELF_FOR_TARGET = $(CROSSCOMPREFIX)readelf
NASM = nasm
EMU=qemu
GDB=gdb
MAKE = make MAKE = make
RM = rm -rf
NASM = nasm
EMU = qemu
GDB = gdb
NASMFLAGS = -felf32 -g NASMFLAGS = -felf32 -g
INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include -I$(TOPDIR)/lwip/src/include -I$(TOPDIR)/lwip/src/include/ipv4 -I$(TOPDIR)/drivers INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include -I$(TOPDIR)/lwip/src/include -I$(TOPDIR)/lwip/src/include/ipv4 -I$(TOPDIR)/drivers
# Compiler options for final code # Compiler options for final code
CFLAGS = -g -m32 -march=i586 -Wall -O2 -fno-builtin -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc $(INCLUDE) $(STACKPROT) CFLAGS = -g -m32 -march=i586 -Wall -O2 -fno-builtin -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc $(INCLUDE) $(STACKPROT)
# Compiler options for debuuging # Compiler options for debugging
#CFLAGS = -g -O -m32 -march=i586 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc $(INCLUDE) $(STACKPROT) #CFLAGS = -g -O -m32 -march=i586 -Wall -fno-builtin -DWITH_FRAME_POINTER -nostdinc $(INCLUDE) $(STACKPROT)
ARFLAGS = rsv ARFLAGS = rsv
RM = rm -rf
LDFLAGS = -T link.ld -z max-page-size=4096 --defsym __BUILD_DATE=$(shell date +'%Y%m%d') --defsym __BUILD_TIME=$(shell date +'%H%M%S') LDFLAGS = -T link.ld -z max-page-size=4096 --defsym __BUILD_DATE=$(shell date +'%Y%m%d') --defsym __BUILD_TIME=$(shell date +'%H%M%S')
STRIP_DEBUG = --strip-debug STRIP_DEBUG = --strip-debug
KEEP_DEBUG = --only-keep-debug KEEP_DEBUG = --only-keep-debug
@ -104,7 +105,7 @@ veryclean: clean
@echo [CC] $@ @echo [CC] $@
$Q$(CC_FOR_TARGET) -c -D__KERNEL__ $(CFLAGS) -o $@ $< $Q$(CC_FOR_TARGET) -c -D__KERNEL__ $(CFLAGS) -o $@ $<
@echo [DEP] $*.dep @echo [DEP] $*.dep
$Q$(CC_FOR_TARGET) -MF $*.dep -MT $*.o -MM $(CFLAGS) $< $Q$(CPP_FOR_TARGET) -MF $*.dep -MT $*.o -MM $(CFLAGS) $<
%.o : %.asm %.o : %.asm