File: Makefile.common

package info (click to toggle)
brickos 0.9.0.dfsg-12.2
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 1,848 kB
  • sloc: ansic: 9,144; cpp: 860; asm: 693; makefile: 656; sh: 124; perl: 61
file content (173 lines) | stat: -rw-r--r-- 4,458 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
### ==========================================================================
###  $Id: Makefile.common,v 1.23 2004/02/17 01:39:07 stephmo Exp $
###  FILE: Makefile.common - definitions common to most brickOS Makefiles
###  brickOS - the independent LEGO Mindstorms OS
### --------------------------------------------------------------------------
###         (this file is included by other brickOS Makefiles)

#
#  Define our default install locations (overridden by packaging systems)
#
prefix = /usr/local
exec_prefix = ${prefix}
PACKAGE = brickos

inst_prefix = ${prefix}

bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/lib
datadir = ${prefix}/share
docdir = ${prefix}/share/doc
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
mandir = ${prefix}/man
includedir = ${prefix}/include

instbindir = ${inst_prefix}/bin
instincdir = ${inst_prefix}/include/${PACKAGE}
instlibdir = ${inst_prefix}/lib/${PACKAGE}

pkgdatadir = $(datadir)/${PACKAGE}
pkgdocdir = $(docdir)/${PACKAGE}
pkgexampledir = $(pkgdocdir)/examples
pkgincludedir = $(includedir)/${PACKAGE}
pkghtmldir = $(pkgdocdir)/html
pkglibdir = $(libdir)/${PACKAGE}


#
#  BEGIN-configuration insert (do not remove this line)
# -------------------------------------------------------
TOOLPREFIX=
SED_SFLAG=
EXT=
CC=cc
CFLAGS=-O2 -Wall
MAKEDEPEND=$(CC) -M
BRICKOS_ROOT=
# -------------------------------------------------------
#  END-configuration insert  (do not remove this line)
#

#
#  test to ensure that user has run configure before building
#
all depend:: ensureConfigured

ensureConfigured:
	@if [ ! -f $(BRICKOS_ROOT)/.configured.flg ]; then \
		echo "" >&2; \
		echo "ERROR- brickOS builds are not yet configured..." >&2; \
		echo " Please run ./configure then try to build again." >&2; \
		echo "" >&2; \
		exit 2; \
	fi


#
#  select purpose based on building hosted utilities or brickOS and demos
#
ifdef BUILDING_HOST_UTILS
# ----------------------------------------------------------------------------
#   defines for build of native compiled utilities
# ----------------------------------------------------------------------------

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

CFLAGS += -std=gnu89
CFLAGS+=-O2 -Wall


else  # ifndef BUILDING_HOST_UTILS

# ----------------------------------------------------------------------------
#   defines for build of cross-compiled parts: brickOS, demos
# ----------------------------------------------------------------------------

# options
COPT  =-O2 -fno-builtin -fomit-frame-pointer
CWARN =-Wall
#
# 2000.03.12 - Paolo Masetti <paolo.masetti@itlug.org>
#
#	- Added -I$(BRICKOS_ROOT)/include/lnp in respect of
#	  Martin Corneluis (cornelius@csd.de) fix for lnp includes
#	  see http://www.lugnet.com/robotics/rcx/legos/?n=498 for details
#
CINC  =-I$(BRICKOS_ROOT)/include -I$(BRICKOS_ROOT)/include/lnp -I.

CFLAGS=$(COPT) $(CWARN) $(CINC) $(CDEFINES)
CXXFLAGS=-DCXX -fno-rtti -fno-exceptions $(CFLAGS)

##
## older options
##

# do we need to pad the srec file with zeros?
#NEED_ZERO_PADDING=--pad-to 0xC000

# how to disassemble
ODFLAGS = --disassemble-all --no-show-raw-insn -m h8300

# which firmware version to act upon
FIRMVERS=firm0309


##
## no user servicable parts below
##

AS=$(TOOLPREFIX)as
AR=$(TOOLPREFIX)ar
LD=$(TOOLPREFIX)ld
NM=$(TOOLPREFIX)nm
OBJCOPY=$(TOOLPREFIX)objcopy
OBJDUMP=$(TOOLPREFIX)objdump
CC=$(TOOLPREFIX)gcc
CXX=$(TOOLPREFIX)g++

MERGEMAP	=$(BRICKOS_ROOT)/util/merge-map
GENLDS 	=$(BRICKOS_ROOT)/util/genlds
FIXDEPS	=$(BRICKOS_ROOT)/util/fixdeps
MAKELX	=$(BRICKOS_ROOT)/util/makelx
MAKEDEPEND	=$(CC) -M $(CINC)

###
### generic rules
###

# how to assemble
%.o: %.s
	$(AS) $< -o $@

# how to compile C source
%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

# how to compile C kernel sources
%.o: $(BRICKOS_ROOT)/kernel/%.c
	$(CC) $(CFLAGS) -c $< -o $@

# how to generate an assembly listing of a kernel source
%.s: $(BRICKOS_ROOT)/kernel/%.c
	$(CC) $(CFLAGS) -c $< -S

# how to compile C++ source
%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c $< -o $@
%.o: %.C
	$(CXX) $(CXXFLAGS) -c $< -o $@

#
#

endif  # ifndef BUILDING_HOST_UTILS

### --------------------------------------------------------------------------
###                         End of FILE: Makefile.common
### ==========================================================================