|
168
|
1 #! /bin/sh |
|
|
2 |
|
|
3 # This script will create a generic Makefile template |
|
|
4 # suitable for use with an installed eCos configuration. |
|
|
5 |
|
|
6 # usage: <eCos_repository>/build_Makefile [<eCos_install_dir>] |
|
|
7 # env: ${SRCS} - the default list of source files |
|
|
8 # ${DST} - the default target |
|
|
9 |
|
|
10 HOME=${1-`pwd`} |
|
|
11 if [ ! -d ${HOME}/install ]; then |
|
|
12 echo "Not an eCos install tree" |
|
|
13 echo "usage: <eCos_repository>/build_Makefile [<eCos_install_dir>]" |
|
|
14 echo "env: \${SRCS} - the default list of source files" |
|
|
15 echo " \${DST} - the default target" |
|
|
16 exit |
|
|
17 fi |
|
|
18 |
|
|
19 cat <<EOF >Makefile |
|
|
20 # |
|
|
21 # Makefile for eCos tests |
|
|
22 # |
|
|
23 |
|
|
24 # Copied from 'makefile' the "install" tree |
|
|
25 |
|
|
26 EOF |
|
|
27 |
|
|
28 grep export ${HOME}/makefile >>Makefile |
|
|
29 |
|
|
30 cat <<EOF >>Makefile |
|
|
31 |
|
|
32 # |
|
|
33 # Target specific flags, etc. |
|
|
34 # |
|
|
35 |
|
|
36 EOF |
|
|
37 |
|
|
38 cat ${HOME}/install/include/pkgconf/ecos.mak >>Makefile |
|
|
39 |
|
|
40 cat <<EOF >>Makefile |
|
|
41 |
|
|
42 # Simple build rules |
|
|
43 |
|
|
44 .c.o: |
|
|
45 \$(CC) -c \$(ECOS_GLOBAL_CFLAGS) -I\$(PREFIX)/include \$*.c |
|
|
46 |
|
|
47 .o: |
|
|
48 \$(CC) \$(ECOS_GLOBAL_LDFLAGS) -L\$(PREFIX)/lib -Ttarget.ld \$*.o -o \$@ |
|
|
49 |
|
|
50 SRCS=${SRCS-source_file.c} |
|
|
51 OBJS=\${SRCS:%.c=%.o} |
|
|
52 DST=${DST-result_prog} |
|
|
53 |
|
|
54 \${DST}: \${OBJS} |
|
|
55 |
|
|
56 EOF |