summaryrefslogtreecommitdiffstats
path: root/Makefile.shared
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-27 14:43:05 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-09-27 14:43:05 +0000
commiteb04e53f6dd24efc86473c6264fc2d8c0d562c90 (patch)
tree61b1eeb6e80394230069cb096315593246acaf6d /Makefile.shared
parent2007-09-27 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadada-examples-eb04e53f6dd24efc86473c6264fc2d8c0d562c90.tar.bz2
2007-09-27 Joel Sherrill <joel.sherrill@oarcorp.com>
* ChangeLog: New tests. Clean up. Rework so all tests use the same shared Makefile for the hard logic of producing an executable. * Makefile, Makefile.shared, README.Makefiles, networkconfig.h, rtems_init.c: New files.
Diffstat (limited to 'Makefile.shared')
-rw-r--r--Makefile.shared71
1 files changed, 71 insertions, 0 deletions
diff --git a/Makefile.shared b/Makefile.shared
new file mode 100644
index 0000000..505c2ef
--- /dev/null
+++ b/Makefile.shared
@@ -0,0 +1,71 @@
+#
+# Subdirectory makefiles do some setup, then we get here
+#
+
+# Tool helpers
+CARGS =-B${RTEMS_MAKEFILE_PATH}/lib/ -specs bsp_specs -qrtems $(CPU_CFLAGS)
+
+# GEN5200 Specific Information
+ifeq ($(RTEMS_BSP_FAMILY),gen5200)
+ LINKARGS+=-qnolinkcmds -T$(RTEMS_LINKCMDS)
+endif
+
+# PC386 Specific Information
+ifeq ($(RTEMS_BSP_FAMILY),pc386)
+ HEADERADDR=0x00097E00
+ START16FILE=$(RTEMS_MAKEFILE_PATH)/lib/start16.bin
+ START16ADDR=0x00097C00
+ RELOCADDR=0x00100000
+ LINKARGS+= -Wl,-Ttext,$(RELOCADDR)
+endif
+
+# Some tests need to be able to do a gethostbyname
+ifeq ($(NEED_ROOTFS_FOR_HOST_INFO),yes)
+ CLEAN_ADDITIONS += FilesystemImage FilesystemImage.c FilesystemImage.h
+ FILESYSTEM_OBJS = FilesystemImage.o
+ FILESYSTEM_SRCS = FilesystemImage.h
+ CFLAGS += -DENABLE_UNTAR_ROOT_FILESYSTEM -I.
+endif
+
+all: $(PROGRAM)
+
+$(PROGRAM): rtems_init.o $(FILESYSTEM_OBJS) $(PROGRAM).adb
+ $(AS:as=gnatmake) -v -O -gnata -gnatE -gnato $(@) -g \
+ -I../src \
+ -bargs -Mgnat_main \
+ -largs $(CARGS) $(LINKARGS) rtems_init.o $(FILESYSTEM_OBJS)
+ $(SIZE) $(@)
+ifeq ($(RTEMS_BSP_FAMILY),pc386)
+ mv $(@) $(@).obj
+ $(OBJCOPY) -O elf32-i386 \
+ --remove-section=.rodata \
+ --remove-section=.comment \
+ --remove-section=.note \
+ --strip-unneeded $(@).obj $(@)
+ $(OBJCOPY) -O binary $(@).obj $(@).bin
+ $(RTEMS_MAKEFILE_PATH)/build-tools/bin2boot -v $(@).bt $(HEADERADDR) \
+ $(START16FILE) $(START16ADDR) 0 $(@).bin $(RELOCADDR) 0
+else
+endif
+
+joel:
+ echo $(NEED_ROOTFS_FOR_HOST_INFO)
+
+rtems_init.o: ../rtems_init.c $(FILESYSTEM_SRCS)
+ $(CC) $(CFLAGS) $(CPU_CFLAGS) -c $<
+
+ifeq ($(NEED_ROOTFS_FOR_HOST_INFO),yes)
+FilesystemImage: ../rootfs/etc/host.conf ../rootfs/etc/hosts
+ (cd ../rootfs ; tar cf - --exclude CVS --exclude .cvsignore .) >$(@)
+
+FilesystemImage.c FilesystemImage.h: FilesystemImage
+ $(PROJECT_ROOT)/bin/bin2c FilesystemImage FilesystemImage
+
+FilesystemImage.o: FilesystemImage.c
+ $(CC) $(CFLAGS) $(CPU_CFLAGS) -c $<
+endif
+
+clean:
+ rm -f b~*.* *.o *.ali $(PROGRAM)
+ rm -f *.num *.exe *.obj *.bin *.bt *.gba
+