r1878
dslinux_amadeus at dslinux.in-berlin.de
dslinux_amadeus at dslinux.in-berlin.de
Tue Sep 11 18:17:05 CEST 2007
Author: amadeus
Date: 2007-09-11 18:16:59 +0200 (Tue, 11 Sep 2007)
New Revision: 1878
Log:
Improve Makefile and C++ demo program
Modified: trunk/user/rtest/Makefile
===================================================================
--- trunk/user/rtest/Makefile 2007-09-09 15:11:02 UTC (rev 1877)
+++ trunk/user/rtest/Makefile 2007-09-11 16:16:59 UTC (rev 1878)
@@ -1,5 +1,5 @@
-# uClinux Makefile for rtest
-# ==========================
+# uClinux Makefile for the sample C++ application "rtest"
+# =======================================================
# name of the executable
EXEC = rtest
@@ -10,10 +10,11 @@
# includes
INCS =
-# libraries to link with
+# libraries to link with (as needed)
# LDLIBS +=
-LDFLAGS += -Wl,-M
+# LD should output a map (to debug the link process)
+# LDFLAGS += -Wl,-M
# declare these targets as phony, so make will not try to look
# for files named like them:
@@ -23,13 +24,24 @@
# enters this directory and wants to build the program.
all: $(EXEC)
+# Translate a .cxx file to produce an object file.
+# CXX: name of the c++ compiler, set by environment
+# CXXFLAGS: needed flags to compile c++ programs, including uClibc++
%.o: %.cxx
$(CXX) -c $(CXXFLAGS) -o $@ $<
-# This is the rule that build the executable.
+# This is the rule that builds(links) the executable.
+# CXX: name of the c++ compiler, set by environment
+# CRTBEGIN/CRTEND: enclosure for inclusion of static constructors.
+# CRTBEGIN must be the first link object
+# CRTEND must be the last link object
+# LDFLAGS: common flags for the linker
+# CXXLIBS: needed libraries for C++ programs, including uClibc++
+# LDLIBS: standard c libraries
$(EXEC): $(OBJS)
- $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(CXXLIBS) $(LDLIBS)
- arm-linux-elf-flthdr -s 100000 -k $(EXEC)
+ $(CXX) -o $@ $(CRTBEGIN) $(LDFLAGS) $(OBJS) $(CXXLIBS) $(LDLIBS) $(CRTEND)
+ # set the stack size (default = 4096 Bytes)
+ arm-linux-elf-flthdr -s 8192 $@
# The romfs target is also phony. It is used to copy your app
# into the DSLinux filesystem image.
Modified: trunk/user/rtest/rtest.cxx
===================================================================
--- trunk/user/rtest/rtest.cxx 2007-09-09 15:11:02 UTC (rev 1877)
+++ trunk/user/rtest/rtest.cxx 2007-09-11 16:16:59 UTC (rev 1878)
@@ -2,7 +2,7 @@
using namespace std;
-/*
+
class test1 {
public:
test1();
@@ -22,9 +22,7 @@
const char *test1::self(void) {
return "test 1";
}
-*/
-/*
class test2: public test1 {
public:
test2();
@@ -45,20 +43,19 @@
const char *test2::self(void) {
return "test 2";
}
-*/
int main()
{
-// test1 *bubi;
+ test2 *bubi;
cout << "start: before new" << endl;
-/*
- bubi = new test1;
+ bubi = new test2;
+
cout << bubi->self()<< endl;
delete bubi;
-*/
+
return 0;
};
More information about the dslinux-commit
mailing list