diff examples/build_Makefile @ 168:ead06911cbae

Add up-to-date examples
author jlarmour
date Wed, 04 Jul 2001 17:34:09 +0000
parents
children f44d40e6cdd3
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/examples/build_Makefile
@@ -0,0 +1,56 @@
+#! /bin/sh
+
+# This script will create a generic Makefile template
+# suitable for use with an installed eCos configuration.
+
+# usage: <eCos_repository>/build_Makefile [<eCos_install_dir>]
+# env:   ${SRCS} - the default list of source files
+#        ${DST}  - the default target
+
+HOME=${1-`pwd`}
+if [ ! -d ${HOME}/install ]; then
+  echo "Not an eCos install tree"
+  echo "usage: <eCos_repository>/build_Makefile [<eCos_install_dir>]"
+  echo "env:   \${SRCS} - the default list of source files"
+  echo "       \${DST}  - the default target"
+  exit
+fi
+
+cat <<EOF >Makefile
+#
+# Makefile for eCos tests
+#
+
+# Copied from 'makefile' the "install" tree
+
+EOF
+
+grep export ${HOME}/makefile >>Makefile
+
+cat <<EOF >>Makefile
+
+#
+# Target specific flags, etc.
+#
+
+EOF
+
+cat ${HOME}/install/include/pkgconf/ecos.mak >>Makefile
+
+cat <<EOF >>Makefile
+
+# Simple build rules
+
+.c.o:
+	\$(CC) -c \$(ECOS_GLOBAL_CFLAGS) -I\$(PREFIX)/include \$*.c
+
+.o:
+	\$(CC) \$(ECOS_GLOBAL_LDFLAGS) -L\$(PREFIX)/lib -Ttarget.ld \$*.o -o \$@
+
+SRCS=${SRCS-source_file.c}
+OBJS=\${SRCS:%.c=%.o}
+DST=${DST-result_prog}
+
+\${DST}: \${OBJS}
+
+EOF