5 # The shell used to execute the commands
8 # Tools from the host environment
12 # Files from the host environment
13 HOST_LIBC
:= $(shell $(GXX
) -print-file-name
=libc.a
)
14 HOST_LIBGCC
:= $(shell $(GXX
) -print-libgcc-file-name
)
16 SRC
:= $(shell [ -d source
] && find source
-name
"*.cpp")
17 OBJ
:= $(SRC
:%.
cpp=%.o
)
18 DEP
:= $(SRC
:%.
cpp=%.dep
)
19 TESTCASE_SRC
:= $(shell [ -d testcase
] && find testcase
-name
"*.cpp")
20 TESTCASE
:= $(TESTCASE_SRC
:%.
cpp=%)
21 TESTCASE_DEP
:= $(TESTCASE_SRC
:%.
cpp=%.dep
)
24 CXXFLAGS_COMMON
:= -std
=c
++0x
-Wall
-Werror
-Wextra
-pedantic-errors
-Weffc
++ -nostdinc
++ -D_LIGHTLIBCPP_CPP10
-D_LIGHTLIBCPP_NO_EXCEPTIONS
-fno-exceptions
25 CXXFLAGS
:= $(CXXFLAGS_COMMON
) $(INCLUDE
)
26 CXXFLAGS_TESTCASE
:= $(CXXFLAGS_COMMON
) $(INCLUDE
) -nodefaultlibs
27 LIBS_TESTCASE
:= -Xlinker
--start-group
-Xlinker
$(STATIC_LIB
) -Xlinker
$(HOST_LIBGCC
) -Xlinker
$(HOST_LIBC
) -Xlinker
--end-group
30 -include $(TESTCASE_DEP
)
32 all-host
: $(STATIC_LIB
)
34 testcases-host
: $(STATIC_LIB
) $(TESTCASE
)
37 @
rm -f
$(DEP
) $(OBJ
) $(STATIC_LIB
) $(TESTCASE_DEP
) $(TESTCASE
) $(TESTCASE
:%=%.gcc
) $(TESTCASE
:%=%.out
)
44 @grep
-r
-H
-n
--exclude
=Doxyfile
--exclude
=Makefile
--exclude-dir
=doc
-e TODO
*
47 @sloccount
include source testcase
50 @echo
" C++ lightlibc++/$(@:%.o=%.cpp)"
51 @
$(GXX
) $(CXXFLAGS
) -MMD
-MF
$(@
:%.o
=%.dep
) -MT
$@
-c
$(@
:%.o
=%.
cpp) -o
$@
54 @echo
" AR $(STATIC_LIB)"
55 @
$(AR
) rc
$(STATIC_LIB
) $(OBJ
)
57 $(TESTCASE
): $(STATIC_LIB
) Makefile
58 @
( $(GXX
) $(CXXFLAGS_TESTCASE
) -MMD
-MF
$(@
:%=%.dep
) -MT
$@
$(@
:%=%.
cpp) $(LIBS_TESTCASE
) -o
$@
2> $(@
:%=%.gcc
) && .
/testcase.sh
$@
) || echo
-e
"\033[01;31mfailed to compile\033[m: $@"