~ubuntu-branches/ubuntu/maverick/u-boot-omap3/maverick

« back to all changes in this revision

Viewing changes to examples/api/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Grawert
  • Date: 2010-03-22 15:06:23 UTC
  • Revision ID: james.westby@ubuntu.com-20100322150623-i21g8rgiyl5dohag
Tags: upstream-2010.3git20100315
ImportĀ upstreamĀ versionĀ 2010.3git20100315

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# (C) Copyright 2007 Semihalf
 
3
#
 
4
# See file CREDITS for list of people who contributed to this
 
5
# project.
 
6
#
 
7
# This program is free software; you can redistribute it and/or
 
8
# modify it under the terms of the GNU General Public License as
 
9
# published by the Free Software Foundatio; either version 2 of
 
10
# the License, or (at your option) any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program; if not, write to the Free Software
 
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 
20
# MA 02111-1307 USA
 
21
#
 
22
 
 
23
ifeq ($(ARCH),ppc)
 
24
LOAD_ADDR = 0x40000
 
25
endif
 
26
ifeq ($(ARCH),arm)
 
27
LOAD_ADDR = 0x1000000
 
28
endif
 
29
 
 
30
include $(TOPDIR)/config.mk
 
31
 
 
32
# Resulting ELF and binary exectuables will be named demo and demo.bin
 
33
OUTPUT-$(CONFIG_API) = $(obj)demo
 
34
OUTPUT = $(OUTPUT-y)
 
35
 
 
36
# Source files located in the examples/api directory
 
37
SOBJ_FILES-$(CONFIG_API) += crt0.o
 
38
COBJ_FILES-$(CONFIG_API) += demo.o
 
39
COBJ_FILES-$(CONFIG_API) += glue.o
 
40
COBJ_FILES-$(CONFIG_API) += libgenwrap.o
 
41
 
 
42
# Source files which exist outside the examples/api directory
 
43
EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/crc32.o
 
44
EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/ctype.o
 
45
EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/div64.o
 
46
EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/string.o
 
47
EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/time.o
 
48
EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/vsprintf.o
 
49
ifeq ($(ARCH),ppc)
 
50
EXT_SOBJ_FILES-$(CONFIG_API) += lib_ppc/ppcstring.o
 
51
endif
 
52
 
 
53
# Create a list of source files so their dependencies can be auto-generated
 
54
SRCS    += $(addprefix $(SRCTREE)/,$(EXT_COBJ_FILES-y:.o=.c))
 
55
SRCS    += $(addprefix $(SRCTREE)/,$(EXT_SOBJ_FILES-y:.o=.S))
 
56
SRCS    += $(addprefix $(SRCTREE)/examples/api/,$(COBJ_FILES-y:.o=.c))
 
57
SRCS    += $(addprefix $(SRCTREE)/examples/api/,$(SOBJ_FILES-y:.o=.S))
 
58
 
 
59
# Create a list of object files to be compiled
 
60
OBJS    += $(addprefix $(obj),$(SOBJ_FILES-y))
 
61
OBJS    += $(addprefix $(obj),$(COBJ_FILES-y))
 
62
OBJS    += $(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y)))
 
63
OBJS    += $(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y)))
 
64
 
 
65
gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
 
66
 
 
67
CPPFLAGS += -I..
 
68
 
 
69
all:    $(obj).depend $(OUTPUT)
 
70
 
 
71
#########################################################################
 
72
 
 
73
$(OUTPUT):      $(OBJS)
 
74
                $(LD) -Ttext $(LOAD_ADDR) -o $@ $^ -L$(gcclibdir) -lgcc
 
75
                $(OBJCOPY) -O binary $@ $(OUTPUT).bin 2>/dev/null
 
76
 
 
77
# Rule to build generic library C files
 
78
$(obj)%.o: $(SRCTREE)/lib_generic/%.c
 
79
        $(CC) -g $(CFLAGS) -c -o $@ $<
 
80
 
 
81
# Rule to build architecture-specific library assembly files
 
82
$(obj)%.o: $(SRCTREE)/lib_$(ARCH)/%.S
 
83
        $(CC) -g $(CFLAGS) -c -o $@ $<
 
84
 
 
85
#########################################################################
 
86
 
 
87
# defines $(obj).depend target
 
88
include $(SRCTREE)/rules.mk
 
89
 
 
90
sinclude $(obj).depend
 
91
 
 
92
#########################################################################