This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: Questions on creating a makefile
- To: tim at cygnetinc dot com (Tim Michals)
- Subject: Re: [ECOS] Questions on creating a makefile
- From: Jesper Skov <jskov at redhat dot com>
- Date: 26 Jan 2000 22:13:33 +0100
- Cc: <ecos-discuss at sourceware dot cygnus dot com>
- References: <003901bf6836$753e67d0$0b01010a@cygnetinc.com>
>>>>> "Tim" == Tim Michals <tim@cygnetinc.com> writes:
Tim> I'm confused on how create a new application. I created a
Tim> application = directory and downloaded several of the test
Tim> applications to test the = board and OS. Now I would like to
Tim> create my own rom application. I = having some confusion on how
Tim> to use the existing makefiles to create my = new application.
Tim> Can anyone provided a sample makefile?=20 =20
Here's the makefile which is part of the documentation examples.
Try to uncomment the appropriate XCC line and type
% make hello
That should show you the basic commands required to link your own
application with eCos.
Jesper
# Mostly written by Jonathan Larmour, Cygnus Solutions
# This file is in the public domain and may be used for any purpose
# PKG_INSTALL_DIR might need to be edited. Right now it is set
# assuming that a user ran pkgconf.tcl in //c/ecos-work on Windows NT,
# or used the Configuration Tool with C:\ecos-work as a build-tree.
#
# You can also override it on the make command-line, e.g.:
# make PKG_INSTALL_DIR=/myecc/install
# or you can set it in your environment
PKG_INSTALL_DIR = //c/ecos-work/install
# You must also set XCC to the name of your cross-compiler, including any
# options it needs.
# Uncomment one of the below, or invoke make with the name of the compiler
# you want, e.g.:
# make XCC="sparclite-elf-gcc -mcpu=sparclite"
# You can also set XCC in your environment
#XCC = mn10300-elf-gcc
#XCC = mips-tx39-elf-gcc
#XCC = sh-elf-gcc
#XCC = powerpc-eabi-gcc -msoft-float -mcpu=860
#XCC = arm-elf-gcc -mcpu=arm7di # AEB
#XCC = arm-elf-gcc -mcpu=arm7tdmi # PID
#XCC = arm-elf-gcc -mcpu=strongarm # EBSA285
#XCC = sparclite-elf-gcc -mcpu=sparclite
#XCC = i686-pc-linux-gnu-gcc
###### VARIABLES
# Any of these can be overriden on the command-line or in your environment
ifeq ($(XCC),sh-elf-gcc)
CFLAGS = -ggdb
else
CFLAGS = -g
endif
CXXFLAGS = $(CFLAGS)
EXTRACFLAGS = -Wall -I$(PKG_INSTALL_DIR)/include -ffunction-sections -fdata-sections
EXTRACXXFLAGS = $(EXTRACFLAGS) -fno-exceptions -fno-rtti -fvtable-gc -finit-priority
LDFLAGS = -nostartfiles -L$(PKG_INSTALL_DIR)/lib -Wl,--gc-sections
LIBS = -Ttarget.ld -nostdlib
LD = $(XCC)
XCXX = $(XCC)
###### RULES
.PHONY: all clean CCCHECK
all: hello twothreads simple-alarm serial
clean:
-rm -f hello hello.o twothreads twothreads.o
-rm -f simple-alarm simple-alarm.o serial serial.o
-rm -f instrument-test instrument-test.o
CCCHECK:
ifeq ($(XCC),)
@echo You must set XCC to the name of your cross-compiler
@false
endif
%.o: %.c
$(XCC) -c -o $*.o $(CFLAGS) $(EXTRACFLAGS) $<
%.o: %.cxx
$(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $<
%.o: %.C
$(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $<
%.o: %.cc
$(XCXX) -c -o $*.o $(CXXFLAGS) $(EXTRACXXFLAGS) $<
hello: CCCHECK hello.o
$(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
twothreads: CCCHECK twothreads.o
$(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
simple-alarm: CCCHECK simple-alarm.o
$(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
serial: CCCHECK serial.o
$(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)
instrument-test: CCCHECK instrument-test.o
$(LD) $(LDFLAGS) -o $@ $@.o $(LIBS)