1 #/***************************************************************************
3 # NBalance.mcc - New Balance MUI Custom Class
4 # Copyright (C) 2008-2009 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
119 # override some variables for non-native builds (cross-compiler)
120 ifneq ($(HOST
), AmigaOS
)
121 ifneq ($(HOST
), AmigaOS4
)
122 ifneq ($(HOST
), MorphOS
)
124 # when we end up here this is either a unix or Aros host
125 # so lets use unix kind of commands
139 ###########################################################################
140 # CPU and DEBUG can be defined outside, defaults to above
141 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
144 # OPTFLAGS are disabled by DEBUG normally!
146 # ignored warnings are:
147 # none - because we want to compile with -Wall all the time
154 DEPFILE
= Makefile.dep
155 DESTDIR
= MUI
:Libs
/MUI
158 TARGET
= $(BINDIR
)/NBalance.mcc
159 TESTTARGET
= $(BINDIR
)/NBalance-Test
161 # Common compiler/linker flags
162 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
163 OPTFLAGS
= -O3
-fomit-frame-pointer
-funroll-loops
165 DEBUGSYM
= -g
-gstabs
166 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) \
167 $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
) -c
168 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
171 ###########################################################################
172 # object files definition
177 COBJS
= Dispatcher.o \
182 TOBJS
= NBalance-Test.o
184 MCCOBJS
= $(addprefix $(OBJDIR
)/,$(LOBJS
)) $(addprefix $(OBJDIR
)/,$(COBJS
))
185 TESTOBJS
= $(addprefix $(OBJDIR
)/,$(COBJS
)) $(addprefix $(OBJDIR
)/,$(TOBJS
))
187 # different options per target OS
190 ##############################
193 # Compiler/link/strip commands
194 ifneq ($(HOST
), AmigaOS4
)
196 STRIP
= ppc-amigaos-strip
197 OBJDUMP
= ppc-amigaos-objdump
200 # Compiler/Linker flags
203 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
204 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
205 -DNO_PPCINLINE_STDARG
-Wa
,-mregnames
206 LDFLAGS
+= -mcrt
=$(CRT
)
208 # additional object files required
209 M68KSTUBS
= $(OBJDIR
)/mccclass_68k.o
214 ##############################
217 # Compiler/link/strip commands
218 ifneq ($(HOST
), AmigaOS
)
219 CC
= m68k-amigaos-gcc
220 STRIP
= m68k-amigaos-strip
221 OBJDUMP
= m68k-amigaos-objdump
224 # Compiler/Linker flags
225 CPU
= -m68020-60
-msoft-float
226 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
-D__amigaos3__
228 LDLIBS
+= -ldebug
-lmui
230 # additional object files required
236 ##############################
239 # Compiler/link/strip commands
240 ifneq ($(HOST
), MorphOS
)
242 STRIP
= ppc-morphos-strip
243 OBJDUMP
= ppc-morphos-objdump
246 # Compiler/Linker flags
248 CFLAGS
+= -noixemul
-DNO_PPCINLINE_STDARG
253 ifeq ($(OS
), aros-i386
)
255 ##############################
258 ifneq ($(HOST
), AROS
)
260 STRIP
= i386-aros-strip
261 OBJDUMP
= i386-aros-objdump
264 # Compiler/Linker flags
265 OPTFLAGS
= -O2
-fomit-frame-pointer
-funroll-loops
266 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
267 LDLIBS
+= -larossupport
-lrom
-lmui
270 ifeq ($(OS
), aros-ppc
)
272 ##############################
275 ifneq ($(HOST
), AROS
)
277 STRIP
= ppc-aros-strip
278 OBJDUMP
= ppc-aros-objdump
281 # Compiler/Linker flags
282 OPTFLAGS
= -O2
-fomit-frame-pointer
-funroll-loops
283 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
284 LDLIBS
+= -larossupport
-lrom
-lmui
287 ifeq ($(OS
), aros-x86_64
)
289 ##############################
292 ifneq ($(HOST
), AROS
)
294 STRIP
= x86_64-aros-strip
295 OBJDUMP
= x86_64-aros-objdump
298 # Compiler/Linker flags
299 OPTFLAGS
= -O2
-fomit-frame-pointer
-funroll-loops
300 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
301 LDLIBS
+= -larossupport
-lrom
-lmui
312 ifeq ($(wildcard $(DEPFILE
)),$(DEPFILE
))
313 # great, we have a dependecies file, let's make our target
314 all: $(BINDIR
) $(OBJDIR
) $(M68KSTUBS
) $(TARGET
) $(TESTTARGET
)
316 # no dependecies, create it and then call make again
318 @make
--no-print-directory
all
321 # for making a release we compile ALL target with no debug
333 make OS
=aros-i386
clean
334 make OS
=aros-i386 DEBUG
=
336 make OS
=aros-ppc
clean
337 make OS
=aros-ppc DEBUG
=
339 make OS
=aros-x86_64
clean
340 make OS
=aros-x86_64 DEBUG
=
342 # make the object directories
347 # make the binary directories
352 # for compiling single .c files
355 @
$(CC
) $(CFLAGS
) $< -o
$@
357 $(OBJDIR
)/mccclass_68k.o
: ..
/include/mccclass_68k.c
359 @
$(CC
) $(CFLAGS
) $< -o
$@
361 # for linking the target
362 $(TARGET
): $(M68KSTUBS
) $(MCCOBJS
)
364 @
$(CC
) -nostartfiles
$(LDFLAGS
) -o
$@.debug
$(MCCOBJS
) $(M68KSTUBS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
366 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
368 # for linking the target
369 $(TESTTARGET
): $(TESTOBJS
)
371 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(TESTOBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
373 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
377 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
) >$(TARGET
).dump
381 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
382 -$(RM
) $(TESTTARGET
) $(TESTTARGET
).debug
$(TESTTARGET
).map
383 -$(RM
) $(MCCOBJS
) $(TESTOBJS
) $(M68KSTUBS
)
393 @echo
" IN $(TARGET)"
394 @
$(CP
) $(TARGET
) $(DESTDIR
)
398 @echo
"Cleaning targets:"
399 @echo
" clean - Cleanup working directory for clean compile"
400 @echo
" distclean - Also cleanup autogenerated files"
402 @echo
"Other generic targets:"
403 @echo
" all - Build $(TARGET)"
404 @echo
" catalogs - Build all available catalogs"
406 @echo
"Install targets:"
407 @echo
" install - Install $(TARGET) into $(DESTDIR)"
410 @echo
" make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
411 @echo
" make DEBUG= : build $(TARGET) without debugging information"
414 ## DEPENDENCY GENERATION ##############
418 @echo
" MK $(DEPFILE)"
419 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE
)
420 @
$(CC
) -MM
-MG
$(CFLAGS
) $(wildcard *.c
) >>$(DEPFILE
)
421 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE
)
422 @
$(SED
) -i
's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE
)
424 # include dependencies file