comparison examples/Makefile @ 168:ead06911cbae

Add up-to-date examples
author jlarmour
date Wed, 04 Jul 2001 17:34:09 +0000
parents
children df4428db3e29
comparison
equal deleted inserted replaced
167:59f91bb9f684 168:ead06911cbae
1 # Mostly written by Jonathan Larmour, Red Hat, Inc.
2 # This file is in the public domain and may be used for any purpose
3
4 # PKG_INSTALL_DIR might need to be edited. Right now it is set
5 # assuming that a user ran pkgconf.tcl in /cygdrive/c/ecos-work on Windows NT,
6 # or used the Configuration Tool with C:\ecos-work as a build-tree.
7 #
8 # You can also override it on the make command-line, e.g.:
9 # make PKG_INSTALL_DIR=/myecc/install
10 # or you can set it in your environment
11
12 PKG_INSTALL_DIR = /cygdrive/c/ecos-work/install
13
14 # You must also set XCC to the name of your cross-compiler, including any
15 # options it needs.
16
17 # Uncomment one of the below, or invoke make with the name of the compiler
18 # you want, e.g.:
19 # make XCC="sparclite-elf-gcc -mcpu=sparclite -msoft-float"
20 # You can also set XCC in your environment
21
22 #XCC = mn10300-elf-gcc # MN10300/AM31
23 #XCC = mn10300-elf-gcc -mam33 # AM33
24 #XCC = mips-tx39-elf-gcc # MIPS TX39
25 #XCC = mips-tx49-elf-gcc -mips2 -EL # MIPS TX49 LITTLE-ENDIAN
26 #XCC = mips-tx49-elf-gcc -mips2 -EB # MIPS TX49 BIG-ENDIAN
27 #XCC = mips64vr4300-elf-gcc -mgp32 -EB # MIPS VR4300
28 #XCC = sh-elf-gcc -m3 -mb # SH3 BIG-ENDIAN
29 #XCC = sh-elf-gcc -m3 -ml # SH3 LITTLE-ENDIAN
30 #XCC = powerpc-eabi-gcc -msoft-float -mcpu=860 # POWERPC
31 #XCC = arm-elf-gcc -mcpu=arm7di # AEB
32 #XCC = arm-elf-gcc -mcpu=arm7tdmi # PID7
33 #XCC = arm-elf-gcc -mcpu=arm7tdmi -mbig-endian # PID7 BIG-ENDIAN
34 #XCC = arm-elf-gcc -mcpu=arm9 # PID9
35 #XCC = thumb-elf-gcc -mthumb-interwork # PID7 THUMB
36 #XCC = thumb-elf-gcc -mthumb-interwork -mbig-endian # PID7 THUMB BIG-ENDIAN
37 #XCC = arm-elf-gcc -mcpu=arm710c -D__CL7111 # CIRRUS LOGIC CL7111
38 #XCC = arm-elf-gcc -mcpu=arm7tdmi -D__EDB7211 # CIRRUS LOGIC EDB7211
39 #XCC = arm-elf-gcc -mcpu=arm7tdmi -D__EDB7209 # CIRRUS LOGIC EDB7209
40 #XCC = arm-elf-gcc -mcpu=arm7tdmi -D__EDB7209 -D__EDB7212 # CIRRUS LOGIC EDB7212
41 #XCC = arm-elf-gcc -mcpu=arm7tdmi # ARM COGENT CMA230
42 #XCC = arm-elf-gcc -mcpu=arm7tdmi -D__CMA222 # ARM COGENT CMA222
43 #XCC = thumb-elf-gcc # ARM COGENT CMA230 THUMB
44 #XCC = arm-elf-gcc -mcpu=strongarm # EBSA285
45 #XCC = arm-elf-gcc -mcpu=strongarm1100 # ASSABET/BRUTUS
46 #XCC = sparclite-elf-gcc -msoft-float -mcpu=sparclite # SPARCLITE
47 #XCC = i686-pc-linux-gnu-gcc # SYNTHETIC LINUX
48 #XCC = i386-elf-gcc # i386 PC
49 #XCC = v850-elf-gcc # NEC v850
50
51 ###### VARIABLES
52 # Any of these can be overriden on the command-line or in your environment
53
54 ifeq ($(findstring sh-elf-gcc,$(XCC)),sh-elf-gcc)
55 CFLAGS = -ggdb
56 else
57 CFLAGS = -g
58 endif
59
60 CXXFLAGS = $(CFLAGS)
61
62 EXTRACFLAGS = -Wall -I$(PKG_INSTALL_DIR)/include -ffunction-sections -fdata-sections
63
64 EXTRACXXFLAGS = $(EXTRACFLAGS) -fno-exceptions -fno-rtti -fvtable-gc -finit-priority
65
66 LDFLAGS = -nostartfiles -L$(PKG_INSTALL_DIR)/lib -Wl,--gc-sections
67 LIBS = -Ttarget.ld -nostdlib
68
69 LD = $(XCC)
70 XCXX = $(XCC)
71
72 ###### RULES
73
74 .PHONY: all clean CCCHECK
75
76 all: hello twothreads simple-alarm serial
77
78 clean:
79 -rm -f hello hello.o twothreads twothreads.o
80 -rm -f simple-alarm simple-alarm.o serial serial.o
81 -rm -f instrument-test instrument-test.o
82
83 CCCHECK:
84 ifeq ($(XCC),)
85 @echo You must set XCC to the name of your cross-compiler
86 @false
87 endif
88
89
90 %.o: %.c
91 $(XCC) -c -o $*.o $(CFLAGS) $(EXTRACFLAGS) $<
92
93 %.o: %.cxx
94 $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $<
95
96 %.o: %.C
97 $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $<
98
99 %.o: %.cc
100 $(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $<
101
102 hello: CCCHECK hello.o
103 $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
104
105 twothreads: CCCHECK twothreads.o
106 $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
107
108 simple-alarm: CCCHECK simple-alarm.o
109 $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
110
111 serial: CCCHECK serial.o
112 $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
113
114 instrument-test: CCCHECK instrument-test.o
115 $(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
116