1 #/***************************************************************************
4 # Copyright (C) 2008 by NList Open Source Team
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # NList classes Support Site: http://www.sf.net/projects/nlist-classes
20 #***************************************************************************/
22 ###########################################################################
23 # This makefile is a very generic one. It tries to identify both, the host
24 # and the target operating system for which YAM should be compiled.
25 # However, this auto-detection can be easily overridden by directly
26 # specifying an option on the commandline while calling 'make'.
30 # # to explicitly compile for AmigaOS3
33 # # to compile for AmigaOS4 but with debugging
34 # > make OS=os4 DEBUG=
37 #############################################
38 # find out the HOST operating system
39 # on which this makefile is run
40 HOST ?
= $(shell uname
)
41 ifeq ($(HOST
), AmigaOS
)
42 ifeq ($(shell uname
-m
), powerpc
)
45 ifeq ($(shell uname
-m
), ppc
)
50 # if no host is identifed (no uname tool)
51 # we assume a AmigaOS build
56 #############################################
57 # now we find out the target OS for
58 # which we are going to compile YAM in case
59 # the caller didn't yet define OS himself
61 ifeq ($(HOST
), AmigaOS4
)
64 ifeq ($(HOST
), AmigaOS
)
67 ifeq ($(HOST
), MorphOS
)
71 # now we find out which CPU system aros will be used
72 ifeq ($(shell uname
-m
), powerpc
)
75 ifeq ($(shell uname
-m
), ppc
)
78 ifeq ($(shell uname
-m
), i386
)
81 ifeq ($(shell uname
-m
), i686
)
84 ifeq ($(shell uname
-m
), x86_64
)
95 #############################################
96 # define common commands we use in this
97 # makefile. Please note that each of them
98 # might be overridden on the commandline.
106 RMDIR
= delete
force all
108 CHMOD
= protect FLAGS
=rwed
118 # override some variables for non-native builds (cross-compiler)
119 ifneq ($(HOST
), AmigaOS
)
120 ifneq ($(HOST
), AmigaOS4
)
121 ifneq ($(HOST
), MorphOS
)
123 # when we end up here this is either a unix or Aros host
124 # so lets use unix kind of commands
138 ###########################################################################
139 # CPU and DEBUG can be defined outside, defaults to above
140 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
143 # OPTFLAGS are disabled by DEBUG normally!
145 # ignored warnings are:
146 # none - because we want to compile with -Wall all the time
155 NBITMAP_DEMO
= $(BINDIR
)/NBitmap-Demo
156 NLIST_DEMO
= $(BINDIR
)/NList-Demo
157 NLISTTREE_DEMO
= $(BINDIR
)/NListtree-Demo
159 # Common compiler/linker flags
160 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
161 OPTFLAGS
= -O3
-fomit-frame-pointer
163 DEBUGSYM
= -g
-gstabs
164 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) \
165 $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
) -c
166 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
169 # different options per target OS
172 ##############################
175 # Compiler/link/strip commands
176 ifneq ($(HOST
), AmigaOS4
)
178 STRIP
= ppc-amigaos-strip
179 OBJDUMP
= ppc-amigaos-objdump
182 # Compiler/Linker flags
185 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
186 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
187 -DNO_PPCINLINE_STDARG
-Wa
,-mregnames
188 LDFLAGS
+= -mcrt
=$(CRT
)
190 # additional object files required
191 M68KSTUBS
= $(OBJDIR
)/mccclass_68k.o
196 ##############################
199 # Compiler/link/strip commands
200 ifneq ($(HOST
), AmigaOS
)
201 CC
= m68k-amigaos-gcc
202 STRIP
= m68k-amigaos-strip
203 OBJDUMP
= m68k-amigaos-objdump
206 # Compiler/Linker flags
207 CPU
= -m68020-60
-msoft-float
208 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
210 LDLIBS
+= -ldebug
-lmui
215 ##############################
218 # Compiler/link/strip commands
219 ifneq ($(HOST
), MorphOS
)
221 STRIP
= ppc-morphos-strip
222 OBJDUMP
= ppc-morphos-objdump
225 # Compiler/Linker flags
227 CFLAGS
+= -noixemul
-DNO_PPCINLINE_STDARG
232 ifeq ($(OS
), aros-i386
)
234 ##############################
237 ifneq ($(HOST
), AROS
)
239 STRIP
= i386-aros-strip
240 OBJDUMP
= i386-aros-objdump
243 # Compiler/Linker flags
244 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
245 LDLIBS
+= -larossupport
-lrom
-lmui
248 ifeq ($(OS
), aros-ppc
)
250 ##############################
253 ifneq ($(HOST
), AROS
)
255 STRIP
= ppc-aros-strip
256 OBJDUMP
= ppc-aros-objdump
259 # Compiler/Linker flags
260 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
261 LDLIBS
+= -larossupport
-lrom
-lmui
264 ifeq ($(OS
), aros-x86_64
)
266 ##############################
269 ifneq ($(HOST
), AROS
)
271 STRIP
= x86_64-aros-strip
272 OBJDUMP
= x86_64-aros-objdump
275 # Compiler/Linker flags
276 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
277 LDLIBS
+= -larossupport
-lrom
-lmui
286 ###########################################################################
287 # Here starts all stuff that is common for all target platforms and
290 NBITMAP_OBJS
= $(OBJDIR
)/NBitmap-Demo.o \
293 NLIST_OBJS
= $(OBJDIR
)/NList-Demo.o \
294 $(OBJDIR
)/NList-Demo2.o \
295 $(OBJDIR
)/NList-Demo3.o \
298 NLISTTREE_OBJS
= $(OBJDIR
)/NListtree-Demo.o \
303 all: $(BINDIR
) $(OBJDIR
) $(NBITMAP_DEMO
) $(NLIST_DEMO
) $(NLISTTREE_DEMO
)
305 # for making a release we compile ALL target with no debug
317 make OS
=aros-i386
clean
318 make OS
=aros-i386 DEBUG
=
320 make OS
=aros-ppc
clean
321 make OS
=aros-ppc DEBUG
=
323 make OS
=aros-x86_64
clean
324 make OS
=aros-x86_64 DEBUG
=
326 # make the object directories
331 # make the binary directories
336 # for compiling single .c files
339 @
$(CC
) $(CFLAGS
) $< -o
$@
341 $(OBJDIR
)/mccclass_68k.o
: ..
/include/mccclass_68k.c
343 @
$(CC
) $(CFLAGS
) $< -o
$@
345 # for linking the target
346 $(NBITMAP_DEMO
): $(NBITMAP_OBJS
)
348 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(NBITMAP_OBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
350 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
353 # for linking the target
354 $(NLIST_DEMO
): $(NLIST_OBJS
)
356 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(NLIST_OBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
358 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
361 # for linking the target
362 $(NLISTTREE_DEMO
): $(NLISTTREE_OBJS
)
364 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(NLISTTREE_OBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
366 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
373 -$(RM
) $(NBITMAP_DEMO
) $(NBITMAP_DEMO
).debug
$(NBITMAP_DEMO
).map
374 -$(RM
) $(NLIST_DEMO
) $(NLIST_DEMO
).debug
$(NLIST_DEMO
).map
375 -$(RM
) $(NLISTTREE_DEMO
) $(NLISTTREE_DEMO
).debug
$(NLISTTREE_DEMO
).map
376 -$(RM
) $(NBITMAP_OBJS
) $(NLIST_OBJS
) $(NLISTTREE_OBJS
)