diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-18 21:17:53 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2009-06-18 21:17:53 +0000 |
commit | 52fc121ac6444a506e2378225194faf5067008e4 (patch) | |
tree | 0cb19e0cbd0ca1deaeea6aba5022d4675a8b8111 /nuttx/examples/nxflat | |
parent | e77fe99962337e339262ea579487eeb3ff50c4b4 (diff) | |
download | px4-nuttx-52fc121ac6444a506e2378225194faf5067008e4.tar.gz px4-nuttx-52fc121ac6444a506e2378225194faf5067008e4.tar.bz2 px4-nuttx-52fc121ac6444a506e2378225194faf5067008e4.zip |
Integrated mknxflat
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1905 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nxflat')
-rw-r--r-- | nuttx/examples/nxflat/tests/Make.defs | 4 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/Makefile | 22 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/errno/Makefile | 24 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/hello++/Makefile | 81 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/hello/Makefile | 24 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/longjmp/Makefile | 24 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/mutex/Makefile | 24 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/pthread/Makefile | 24 | ||||
-rw-r--r-- | nuttx/examples/nxflat/tests/task/Makefile | 24 |
9 files changed, 182 insertions, 69 deletions
diff --git a/nuttx/examples/nxflat/tests/Make.defs b/nuttx/examples/nxflat/tests/Make.defs index 3b6400730..b0c035d0b 100644 --- a/nuttx/examples/nxflat/tests/Make.defs +++ b/nuttx/examples/nxflat/tests/Make.defs @@ -34,9 +34,9 @@ ############################################################################ NXFLATCC = $(CC) -NXFLATCFLAGS = $(CFLAGS) +NXFLATCFLAGS = $(CPICFLAGS) NXFLATCXX = $(CXX) -NXFLATCXXFLAGS = $(CXXFLAGS) +NXFLATCXXFLAGS = $(CXXPICFLAGS) NXFLATCC = $(CC) NXFLATCFLAGS = $(CFLAGS) diff --git a/nuttx/examples/nxflat/tests/Makefile b/nuttx/examples/nxflat/tests/Makefile index 003c187f3..35ad4644e 100644 --- a/nuttx/examples/nxflat/tests/Makefile +++ b/nuttx/examples/nxflat/tests/Makefile @@ -33,23 +33,25 @@ # ############################################################################ -TESTDIRS := errno hello hello++ longjmp mutex pthread signal task +# Most of these do no build yet +#SUBDIRS = errno hello hello++ longjmp mutex pthread signal task +SUBDIRS = errno hello pthread task -define TEST_template +define DIR_template $(1)_$(2): $(MAKE) -C $(1) $(3) endef -$(foreach TEST, $(TESTDIRS), $(eval $(call TEST_template,$(TEST),build, all))) -$(foreach TEST, $(TESTDIRS), $(eval $(call TEST_template,$(TEST),clean,clean))) -$(foreach TEST, $(TESTDIRS), $(eval $(call TEST_template,$(TEST),install,install))) - all: build -.PHONY: all build clean user_install root_install +.PHONY: all build clean install + +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all))) +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean))) +$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install))) -build: $(foreach TEST, $(TESTDIRS), $(TEST)_build) +build: $(foreach DIR, $(SUBDIRS), $(DIR)_build) -clean: $(foreach TEST, $(TESTDIRS), $(TEST)_clean) +clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean) -install: $(foreach TEST, $(TESTDIRS), $(TEST)_install) +install: $(foreach DIR, $(SUBDIRS), $(DIR)_install) diff --git a/nuttx/examples/nxflat/tests/errno/Makefile b/nuttx/examples/nxflat/tests/errno/Makefile index 110886f92..6a351b96f 100644 --- a/nuttx/examples/nxflat/tests/errno/Makefile +++ b/nuttx/examples/nxflat/tests/errno/Makefile @@ -39,22 +39,34 @@ include ../Make.defs # NXFLAT make info BIN = errno -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) -$(OBJS): %.o: %.c +$(R1OBJS): %.o: %.c + $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ -$(BIN).rnx: $(OBJS) +$(BIN).r1: $(R1OBJS) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC): $(BIN).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN): $(BIN).rnx +$(BIN): $(BIN).r2 touch $(BIN) # For now clean: - rm -f $(BIN) *.o *.rnx *~ .*.swp core + rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core install: install -D $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/nuttx/examples/nxflat/tests/hello++/Makefile b/nuttx/examples/nxflat/tests/hello++/Makefile index 584c8c4aa..5fb39b0e7 100644 --- a/nuttx/examples/nxflat/tests/hello++/Makefile +++ b/nuttx/examples/nxflat/tests/hello++/Makefile @@ -41,31 +41,46 @@ BIN1 = hello++1 BIN2 = hello++2 BIN3 = hello++3 #BIN4 = hello++4 +ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4) -SRCS1 = $(BIN1).c -OBJS1 = $(SRCS1:.c=.o) +R1SRCS1 = $(BIN1).c +OBJS1 = $(R1SRCS1:.c=.o) +R2SRC1 = $(BIN1)-thunk.S +R2OBJ1 = $(R2SRC1:.S=.o) -SRCS2 = $(BIN2).c -OBJS2 = $(SRCS2:.c=.o) +R1SRCS2 = $(BIN2).c +OBJS2 = $(R1SRCS2:.c=.o) +R2SRC2 = $(BIN2)-thunk.S +R2OBJ2 = $(R2SRC2:.S=.o) -SRCS3 = $(BIN3).c -OBJS3 = $(SRCS3:.c=.o) +R1SRCS3 = $(BIN3).c +OBJS3 = $(R1SRCS3:.c=.o) +R2SRC3 = $(BIN3)-thunk.S +R2OBJ3 = $(R2SRC3:.S=.o) -#SRCS4 = $(BIN4).c -#OBJS4 = $(SRCS4:.c=.o) +#R1SRCS4 = $(BIN4).c +#OBJS4 = $(R1SRCS4:.c=.o) +#R2SRC4 = $(BIN4)-thunk.S +#R2OBJ4 = $(R2SRC4:.S=.o) -CXXOBJS = $(OBJS1) $(OBJS2) $(OBJS3) # $(OBJS4) +DERIVED = $(R2SRC1) $(R2SRC2) $(R2SRC3) $(R2SRC4) + +R1CXXOBJS = $(R1OBJS1) $(R1OBJS2) $(R1OBJS3) # $(R1OBJS4) +R2AOBJS = $(R2OBJ1) $(R2OBJ2) $(R2OBJ3) # $(R2OBJ4) LIBSTDC_STUBS_DIR = $(TOPDIR)/libxx LIBSTDC_STUBS_LIB = $(LIBSTDC_STUBS_DIR)/liblibxx.a all: $(BIN1) $(BIN2) $(BIN3) # $(BIN4) -$(CXXOBJS): %.o: %.cpp +$(R1CXXOBJS): %.o: %.cpp $(NXFLATCXX) -c $(NXFLATCXXFLAGS) $< -o $@ +$(R2AOBJS): %.o: %.S + $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ + # This contains libstdc++ stubs to that you can build C++ code -# without actually have libstdc++ +# without actually having libstdc++ $(LIBSTDC_STUBS_LIB): $(MAKE) -C $(LIBSTDC_STUBS_DIR) TOPDIR=$(TOPDIR) @@ -75,16 +90,28 @@ $(LIBSTDC_STUBS_LIB): # BIN2 contains a class that implements hello world, but it is # not statically initialized. -$(BIN1).rnx: $(OBJS1) +$(BIN1).r1: $(OBJS1) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN1): $(BIN1).rnx +$(R2SRC1): $(BIN1).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN1).r2: $(R2OBJ1) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(BIN1): $(BIN1).r2 touch $(BIN1) # For now -$(BIN2).rnx: $(OBJS2) $(LIBSTDC_STUBS_LIB) +$(BIN2).r1: $(OBJS2) $(LIBSTDC_STUBS_LIB) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC2): $(BIN2).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN2).r2: $(R2OBJ2) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN2): $(BIN2).rnx +(BIN2): $(BIN2).r2 touch $(BIN2) # For now # BIN3 and BIN4 require that we include --cxx in the xflat-ld command. @@ -93,26 +120,38 @@ $(BIN2): $(BIN2).rnx # # BIN3 is equivalent to BIN2 except that is uses static initializers -$(BIN3).rnx: $(OBJS3) $(LIBSTDC_STUBS_LIB) +$(BIN3).r1: $(OBJS3) $(LIBSTDC_STUBS_LIB) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC3): $(BI3N).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN3).r2: $(R2OBJ3) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN3): $(BIN3).rnx +$(BIN3): $(BIN3).r2 touch $(BIN3) # For now # BIN4 is similar to BIN3 except that it uses the streams code from libstdc++ # # NOTE: libstdc++ is not available for XFLAT as of this writing # -#$(BIN4).rnx: $(OBJS4) $(LIBSTDC_STUBS_LIB) +#$(BIN4).r1: $(OBJS4) $(LIBSTDC_STUBS_LIB) +# $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ +# +#$(R2SRC4): $(BIN4).r1 +# $(MKNXFLAT) -o $@ $^ +# +#$(BIN4).r2: $(R2OBJ4) # $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ # -#$(BIN4): $(BIN4).rnx +#$(BIN4): $(BIN4).r2 # touch $(BIN4) # For now clean: - rm -f $(BIN1) $(BIN2) $(BIN3) $(BIN4) *.o *.rnx *~ .*.swp core + rm -f $(ALL_BIN) $(DERIVED) *.o *.r1 *.r2 *~ .*.swp core -user_install: $(BIN1) $(BIN2) $(BIN3) # $(BIN4) +install: $(ALL_BIN) install -D $(BIN1) $(ROMFS_DIR)/$(BIN1) install -D $(BIN2) $(ROMFS_DIR)/$(BIN2) install -D $(BIN3) $(ROMFS_DIR)/$(BIN3) diff --git a/nuttx/examples/nxflat/tests/hello/Makefile b/nuttx/examples/nxflat/tests/hello/Makefile index 78492d59f..1f5327a60 100644 --- a/nuttx/examples/nxflat/tests/hello/Makefile +++ b/nuttx/examples/nxflat/tests/hello/Makefile @@ -39,22 +39,34 @@ include ../Make.defs # NXFLAT make info BIN = hello -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) -$(OBJS): %.o: %.c +$(R1OBJS): %.o: %.c + $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ -$(BIN).rnx: $(OBJS) +$(BIN).r1: $(R1OBJS) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC): $(BIN).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN): $(BIN).rnx +$(BIN): $(BIN).r2 touch $(BIN) # For now clean: - rm -f $(BIN) *.o *.rnx *~ .*.swp core + rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core install: install -D $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/nuttx/examples/nxflat/tests/longjmp/Makefile b/nuttx/examples/nxflat/tests/longjmp/Makefile index fea6d419e..fa2dd05c2 100644 --- a/nuttx/examples/nxflat/tests/longjmp/Makefile +++ b/nuttx/examples/nxflat/tests/longjmp/Makefile @@ -39,22 +39,34 @@ include ../Make.defs # NXFLAT make info BIN = longjmp -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) -$(OBJS): %.o: %.c +$(R1OBJS): %.o: %.c + $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ -$(BIN).rnx: $(OBJS) +$(BIN).r1: $(R1OBJS) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC): $(BIN).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN): $(BIN).rnx +$(BIN): $(BIN).r2 touch $(BIN) # For now clean: - rm -f $(BIN) *.o *.rnx *~ .*.swp core + rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core install: install -D $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/nuttx/examples/nxflat/tests/mutex/Makefile b/nuttx/examples/nxflat/tests/mutex/Makefile index 675a050eb..8e0254d3e 100644 --- a/nuttx/examples/nxflat/tests/mutex/Makefile +++ b/nuttx/examples/nxflat/tests/mutex/Makefile @@ -39,22 +39,34 @@ include ../Make.defs # NXFLAT make info BIN = mutex -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) -$(OBJS): %.o: %.c +$(R1OBJS): %.o: %.c + $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ -$(BIN).rnx: $(OBJS) +$(BIN).r1: $(R1OBJS) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC): $(BIN).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN): $(BIN).rnx +$(BIN): $(BIN).r2 touch $(BIN) # For now clean: - rm -f $(BIN) *.o *.rnx *~ .*.swp core + rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core install: install -D $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/nuttx/examples/nxflat/tests/pthread/Makefile b/nuttx/examples/nxflat/tests/pthread/Makefile index 04960b7a8..785c9804f 100644 --- a/nuttx/examples/nxflat/tests/pthread/Makefile +++ b/nuttx/examples/nxflat/tests/pthread/Makefile @@ -39,22 +39,34 @@ include ../Make.defs # NXFLAT make info BIN = pthread -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) -$(OBJS): %.o: %.c +$(R1OBJS): %.o: %.c + $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ -$(BIN).rnx: $(OBJS) +$(BIN).r1: $(R1OBJS) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC): $(BIN).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN): $(BIN).rnx +$(BIN): $(BIN).r2 touch $(BIN) # For now clean: - rm -f $(BIN) *.o *.rnx *~ .*.swp core + rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core install: install -D $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/nuttx/examples/nxflat/tests/task/Makefile b/nuttx/examples/nxflat/tests/task/Makefile index bd93980b0..c57088375 100644 --- a/nuttx/examples/nxflat/tests/task/Makefile +++ b/nuttx/examples/nxflat/tests/task/Makefile @@ -39,22 +39,34 @@ include ../Make.defs # NXFLAT make info BIN = task -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) +R1SRCS = $(BIN).c +R1OBJS = $(R1SRCS:.c=.o) + +R2SRC = $(BIN)-thunk.S +R2OBJ = $(R2SRC:.S=.o) all: $(BIN) -$(OBJS): %.o: %.c +$(R1OBJS): %.o: %.c + $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ + +$(R2OBJ): %.o: %.S $(NXFLATCC) -c $(NXFLATCFLAGS) $< -o $@ -$(BIN).rnx: $(OBJS) +$(BIN).r1: $(R1OBJS) + $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ + +$(R2SRC): $(BIN).r1 + $(MKNXFLAT) -o $@ $^ + +$(BIN).r2: $(R2OBJ) $(NXFLATLD) -r $(NXFLATLDFLAGS) -o $@ $^ -$(BIN): $(BIN).rnx +$(BIN): $(BIN).r2 touch $(BIN) # For now clean: - rm -f $(BIN) *.o *.rnx *~ .*.swp core + rm -f $(BIN) $(R2SRC) *.o *.r1 *.r2 *~ .*.swp core install: install -D $(BIN) $(ROMFS_DIR)/$(BIN) |