761982ecf3f3d1b5cce80280bb90ef224810e8d5
1 TARGET_PREFIX
=lm32-elf-
5 CC_normal
:= $(TARGET_PREFIX
)gcc
6 CX_normal
:= $(TARGET_PREFIX
)g
++
7 AS_normal
:= $(TARGET_PREFIX
)as
8 AR_normal
:= $(TARGET_PREFIX
)ar
9 LD_normal
:= $(TARGET_PREFIX
)ld
10 OBJCOPY_normal
:= $(TARGET_PREFIX
)objcopy
11 RANLIB_normal
:= $(TARGET_PREFIX
)ranlib
13 CC_quiet
= @echo
" CC " $@
&& $(TARGET_PREFIX
)gcc
14 CX_quiet
= @echo
" CX " $@
&& $(TARGET_PREFIX
)g
++
15 AS_quiet
= @echo
" AS " $@
&& $(TARGET_PREFIX
)as
16 AR_quiet
= @echo
" AR " $@
&& $(TARGET_PREFIX
)ar
17 LD_quiet
= @echo
" LD " $@
&& $(TARGET_PREFIX
)ld
18 OBJCOPY_quiet
= @echo
" OBJCOPY " $@
&& $(TARGET_PREFIX
)objcopy
19 RANLIB_quiet
= @echo
" RANLIB " $@
&& $(TARGET_PREFIX
)ranlib
21 MSC_GIT_ID
:= $(shell cd
$(MSCDIR
) && python3
-c
"from misoclib.identifier.git import get_id; print(hex(get_id()), end='')")
29 OBJCOPY
= $(OBJCOPY_normal
)
30 RANLIB
= $(RANLIB_normal
)
37 OBJCOPY
= $(OBJCOPY_quiet
)
38 RANLIB
= $(RANLIB_quiet
)
43 INCLUDES
= -I
$(MSCDIR
)/software
/include/base
-I
$(MSCDIR
)/software
/include -I
$(MSCDIR
)/common
44 COMMONFLAGS
= -Os
-mbarrel-shift-enabled
-mmultiply-enabled
-mdivide-enabled
-msign-extend-enabled \
45 -Wall
-fno-builtin
-nostdinc
-DMSC_GIT_ID
=$(MSC_GIT_ID
) $(INCLUDES
)
46 CFLAGS
= $(COMMONFLAGS
) -Wstrict-prototypes
-Wold-style-definition
-Wmissing-prototypes
47 CXXFLAGS
= $(COMMONFLAGS
) -fno-exceptions
-ffreestanding
48 LDFLAGS
= -nostdlib
-nodefaultlibs
-L
$(MSCDIR
)/software
/include
50 # compile and generate dependencies, based on
51 # http://scottmcpeak.com/autodepend/autodepend.html
54 $(CX
) -c
$(CXXFLAGS
) $(1) $< -o
$*.o
55 @
$(CX_normal
) -MM
$(CXXFLAGS
) $(1) $< > $*.d
57 @sed
-e
's|.*:|$*.o:|' < $*.d.tmp
> $*.d
58 @sed
-e
's/.*://' -e
's/\\$$//' < $*.d.tmp | fmt
-1 | \
59 sed
-e
's/^ *//' -e
's/$$/:/' >> $*.d
64 $(CC
) -c
$(CFLAGS
) $(1) $< -o
$*.o
65 @
$(CC_normal
) -MM
$(CFLAGS
) $(1) $< > $*.d
67 @sed
-e
's|.*:|$*.o:|' < $*.d.tmp
> $*.d
68 @sed
-e
's/.*://' -e
's/\\$$//' < $*.d.tmp | fmt
-1 | \
69 sed
-e
's/^ *//' -e
's/$$/:/' >> $*.d