mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
e91c317139
This ease understanding from which lib the file is included and also allow having simple filenames in the libs.
68 lines
1.9 KiB
Makefile
68 lines
1.9 KiB
Makefile
ifeq ($(TRIPLE),--native--)
|
|
TARGET_PREFIX=
|
|
else
|
|
TARGET_PREFIX=$(TRIPLE)-
|
|
endif
|
|
|
|
RM ?= rm -f
|
|
PYTHON ?= python3
|
|
|
|
ifeq ($(CLANG),1)
|
|
CC_normal := clang -target $(TRIPLE) -integrated-as
|
|
CX_normal := clang++ -target $(TRIPLE) -integrated-as
|
|
else
|
|
CC_normal := $(TARGET_PREFIX)gcc -std=gnu99
|
|
CX_normal := $(TARGET_PREFIX)g++
|
|
endif
|
|
AR_normal := $(TARGET_PREFIX)ar
|
|
LD_normal := $(TARGET_PREFIX)ld
|
|
OBJCOPY_normal := $(TARGET_PREFIX)objcopy
|
|
|
|
CC_quiet = @echo " CC " $@ && $(CC_normal)
|
|
CX_quiet = @echo " CX " $@ && $(CX_normal)
|
|
AR_quiet = @echo " AR " $@ && $(AR_normal)
|
|
LD_quiet = @echo " LD " $@ && $(LD_normal)
|
|
OBJCOPY_quiet = @echo " OBJCOPY " $@ && $(OBJCOPY_normal)
|
|
|
|
ifeq ($(V),1)
|
|
CC = $(CC_normal)
|
|
CX = $(CX_normal)
|
|
AR = $(AR_normal)
|
|
LD = $(LD_normal)
|
|
OBJCOPY = $(OBJCOPY_normal)
|
|
else
|
|
CC = $(CC_quiet)
|
|
CX = $(CX_quiet)
|
|
AR = $(AR_quiet)
|
|
LD = $(LD_quiet)
|
|
OBJCOPY = $(OBJCOPY_quiet)
|
|
endif
|
|
|
|
# http://scottmcpeak.com/autodepend/autodepend.html
|
|
# Generate *.d Makefile dependencies fragments, include using;
|
|
# -include $(OBJECTS:.o=.d)
|
|
DEPFLAGS += -MD -MP
|
|
|
|
# Toolchain options
|
|
#
|
|
INCLUDES = -I$(SOC_DIRECTORY)/software/include/base \
|
|
-I$(SOC_DIRECTORY)/software/include \
|
|
-I$(SOC_DIRECTORY)/software \
|
|
-I$(BUILDINC_DIRECTORY) \
|
|
-I$(CPU_DIRECTORY)
|
|
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES)
|
|
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
|
|
CXXFLAGS = $(COMMONFLAGS) -std=c++11 -I$(SOC_DIRECTORY)/software/include/basec++ -fexceptions -fno-rtti -ffreestanding
|
|
LDFLAGS = -nostdlib -nodefaultlibs -L$(BUILDINC_DIRECTORY)
|
|
|
|
define compilexx
|
|
$(CX) -c $(CXXFLAGS) $(1) $< -o $@
|
|
endef
|
|
|
|
define compile
|
|
$(CC) -c $(CFLAGS) $(1) $< -o $@
|
|
endef
|
|
|
|
define assemble
|
|
$(CC) -c $(CFLAGS) -o $@ $<
|
|
endef
|