summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mk/build.mk2
-rw-r--r--package/helloworld/Makefile22
-rw-r--r--package/helloworld/src/helloworld.c2
-rw-r--r--package/helloworld/src/helloworld.cc6
4 files changed, 30 insertions, 2 deletions
diff --git a/mk/build.mk b/mk/build.mk
index 78b4789e3..cd0063574 100644
--- a/mk/build.mk
+++ b/mk/build.mk
@@ -347,6 +347,8 @@ defconfig: .menu $(CONFIG)/conf
fi
@if [ ! -z "$(ADK_TEST_BASE)" ];then \
echo "ADK_PACKAGE_ADKTEST=y" >> $(ADK_TOPDIR)/.defconfig; \
+ echo "ADK_PACKAGE_FILE=y" >> $(ADK_TOPDIR)/.defconfig; \
+ echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
fi
@if [ ! -z "$(ADK_TEST_TOOLCHAIN)" ];then \
echo "ADK_PACKAGE_HELLOWORLD=y" >> $(ADK_TOPDIR)/.defconfig; \
diff --git a/package/helloworld/Makefile b/package/helloworld/Makefile
index c993cde38..a28d5ca9a 100644
--- a/package/helloworld/Makefile
+++ b/package/helloworld/Makefile
@@ -21,11 +21,31 @@ INSTALL_STYLE:= manual
do-build:
$(TARGET_CC) $(TARGET_CFLAGS) -o $(WRKBUILD)/helloworld $(WRKBUILD)/helloworld.c
+ifeq ($(ADK_TARGET_ARCH_METAG),)
$(TARGET_CC) $(TARGET_CFLAGS) -static -o $(WRKBUILD)/helloworld.static $(WRKBUILD)/helloworld.c
+endif
+ifeq ($(ADK_TOOLCHAIN_WITH_CXX),y)
+ $(TARGET_CXX) $(TARGET_CXXFLAGS) -o $(WRKBUILD)/helloworld-cxx $(WRKBUILD)/helloworld.cc
+ifeq ($(ADK_TARGET_ARCH_METAG),)
+ $(TARGET_CXX) $(TARGET_CXXFLAGS) -static -static-libstdc++ -o $(WRKBUILD)/helloworld-cxx.static $(WRKBUILD)/helloworld.cc
+endif
+endif
helloworld-install:
$(INSTALL_DIR) $(IDIR_HELLOWORLD)/usr/bin
- $(INSTALL_BIN) $(WRKBUILD)/helloworld{,.static} \
+ $(INSTALL_BIN) $(WRKBUILD)/helloworld \
$(IDIR_HELLOWORLD)/usr/bin
+ifeq ($(ADK_TARGET_ARCH_METAG),)
+ $(INSTALL_BIN) $(WRKBUILD)/helloworld.static \
+ $(IDIR_HELLOWORLD)/usr/bin
+endif
+ifeq ($(ADK_TOOLCHAIN_WITH_CXX),y)
+ $(INSTALL_BIN) $(WRKBUILD)/helloworld-cxx \
+ $(IDIR_HELLOWORLD)/usr/bin
+ifeq ($(ADK_TARGET_ARCH_METAG),)
+ $(INSTALL_BIN) $(WRKBUILD)/helloworld-cxx.static \
+ $(IDIR_HELLOWORLD)/usr/bin
+endif
+endif
include $(ADK_TOPDIR)/mk/pkg-bottom.mk
diff --git a/package/helloworld/src/helloworld.c b/package/helloworld/src/helloworld.c
index 232880377..02f468f1f 100644
--- a/package/helloworld/src/helloworld.c
+++ b/package/helloworld/src/helloworld.c
@@ -1,6 +1,6 @@
#include <stdio.h>
int main() {
- printf("Hello World\n");
+ printf("Hello World! (C)\n");
return 0;
}
diff --git a/package/helloworld/src/helloworld.cc b/package/helloworld/src/helloworld.cc
new file mode 100644
index 000000000..ac640ca2a
--- /dev/null
+++ b/package/helloworld/src/helloworld.cc
@@ -0,0 +1,6 @@
+#include <iostream>
+
+main() {
+ std::cout<<"Hello World! (C++)\n";
+ return 0;
+}