1 include $(MSCDIR
)/software
/include/generated
/cpu.mak
2 TARGET_PREFIX
=$(TRIPLE
)-
8 CC_normal
:= clang
-target
$(TRIPLE
) -integrated-as
9 CX_normal
:= clang
++ -target
$(TRIPLE
) -integrated-as
11 CC_normal
:= $(TARGET_PREFIX
)gcc
12 CX_normal
:= $(TARGET_PREFIX
)g
++
14 AR_normal
:= $(TARGET_PREFIX
)ar
15 LD_normal
:= $(TARGET_PREFIX
)ld
16 OBJCOPY_normal
:= $(TARGET_PREFIX
)objcopy
18 CC_quiet
= @echo
" CC " $@
&& $(CC_normal
)
19 CX_quiet
= @echo
" CX " $@
&& $(CX_normal
)
20 AR_quiet
= @echo
" AR " $@
&& $(AR_normal
)
21 LD_quiet
= @echo
" LD " $@
&& $(LD_normal
)
22 OBJCOPY_quiet
= @echo
" OBJCOPY " $@
&& $(OBJCOPY_normal
)
24 MSC_GIT_ID
:= $(shell cd
$(MSCDIR
) && $(PYTHON
) -c
"from misoclib.cpu.identifier import get_id; print(hex(get_id()), end='')")
31 OBJCOPY
= $(OBJCOPY_normal
)
37 OBJCOPY
= $(OBJCOPY_quiet
)
42 INCLUDES
= -I
$(MSCDIR
)/software
/include/base
-I
$(MSCDIR
)/software
/include -I
$(MSCDIR
)/common
43 COMMONFLAGS
= -Os
$(CPUFLAGS
) -fomit-frame-pointer
-Wall
-fno-builtin
-nostdinc
-DMSC_GIT_ID
=$(MSC_GIT_ID
) $(INCLUDES
)
44 CFLAGS
= $(COMMONFLAGS
) -fexceptions
-Wstrict-prototypes
-Wold-style-definition
-Wmissing-prototypes
45 CXXFLAGS
= $(COMMONFLAGS
) -std
=c
++11 -I
$(MSCDIR
)/software
/include/basec
++ -fexceptions
-fno-rtti
-ffreestanding
46 LDFLAGS
= -nostdlib
-nodefaultlibs
-L
$(MSCDIR
)/software
/include
48 # compile and generate dependencies, based on
49 # http://scottmcpeak.com/autodepend/autodepend.html
52 $(CX
) -c
$(CXXFLAGS
) $(1) $< -o
$*.o
53 @
$(CX_normal
) -MM
$(CXXFLAGS
) $(1) $< > $*.d
55 @sed
-e
's|.*:|$*.o:|' < $*.d.tmp
> $*.d
56 @sed
-e
's/.*://' -e
's/\\$$//' < $*.d.tmp | fmt
-1 | \
57 sed
-e
's/^ *//' -e
's/$$/:/' >> $*.d
62 $(CC
) -c
$(CFLAGS
) $(1) $< -o
$*.o
63 @
$(CC_normal
) -MM
$(CFLAGS
) $(1) $< > $*.d
65 @sed
-e
's|.*:|$*.o:|' < $*.d.tmp
> $*.d
66 @sed
-e
's/.*://' -e
's/\\$$//' < $*.d.tmp | fmt
-1 | \
67 sed
-e
's/^ *//' -e
's/$$/:/' >> $*.d
72 $(CC
) -c
$(CFLAGS
) -o
$*.o
$<