1 #/***************************************************************************
3 # BetterString.mcc - A better String gadget MUI Custom Class
4 # Copyright (C) 1997-2000 Allan Odgaard
5 # Copyright (C) 2005-2009 by BetterString.mcc Open Source Team
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library 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 GNU
15 # Lesser General Public License for more details.
17 # BetterString class Support Site: http://www.sf.net/projects/bstring-mcc/
21 #***************************************************************************/
23 ###########################################################################
24 # This makefile is a very generic one. It tries to identify both, the host
25 # and the target operating system for which YAM should be compiled.
26 # However, this auto-detection can be easily overridden by directly
27 # specifying an option on the commandline while calling 'make'.
31 # # to explicitly compile for AmigaOS3
34 # # to compile for AmigaOS4 but with debugging
35 # > make OS=os4 DEBUG=
38 #############################################
39 # find out the HOST operating system
40 # on which this makefile is run
41 HOST ?
= $(shell uname
)
42 ifeq ($(HOST
), AmigaOS
)
43 ifeq ($(shell uname
-m
), powerpc
)
46 ifeq ($(shell uname
-m
), ppc
)
51 # if no host is identifed (no uname tool)
52 # we assume a AmigaOS build
57 #############################################
58 # now we find out the target OS for
59 # which we are going to compile YAM in case
60 # the caller didn't yet define OS himself
62 ifeq ($(HOST
), AmigaOS4
)
65 ifeq ($(HOST
), AmigaOS
)
68 ifeq ($(HOST
), MorphOS
)
72 # now we find out which CPU system aros will be used
73 ifeq ($(shell uname
-m
), powerpc
)
76 ifeq ($(shell uname
-m
), ppc
)
79 ifeq ($(shell uname
-m
), i386
)
82 ifeq ($(shell uname
-m
), i686
)
85 ifeq ($(shell uname
-m
), x86_64
)
96 #############################################
97 # define common commands we use in this
98 # makefile. Please note that each of them
99 # might be overridden on the commandline.
107 RMDIR
= delete
force all
109 CHMOD
= protect FLAGS
=rwed
116 # override commands for native builds
117 ifeq ($(HOST
), AmigaOS4
)
120 RMDIR
= delete
force all
124 ifeq ($(HOST
), AmigaOS
)
127 RMDIR
= delete
force all
130 ifeq ($(HOST
), MorphOS
)
133 RMDIR
= delete
force all
143 # override some variables for non-native builds (cross-compiler)
144 ifneq ($(HOST
), AmigaOS
)
145 ifneq ($(HOST
), AmigaOS4
)
146 ifneq ($(HOST
), MorphOS
)
148 # when we end up here this is either a unix or Aros host
149 # so lets use unix kind of commands
163 ###########################################################################
164 # CPU and DEBUG can be defined outside, defaults to above
165 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
168 # OPTFLAGS are disabled by DEBUG normally!
170 # ignored warnings are:
171 # none - because we want to compile with -Wall all the time
178 DEPFILE
= Makefile.dep
179 DESTDIR
= MUI
:Libs
/MUI
182 TARGET
= $(BINDIR
)/BetterString.mcc
183 TESTTARGET
= $(BINDIR
)/BetterString-Test
185 # Common compiler/linker flags
186 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
187 OPTFLAGS
= -O3
-fomit-frame-pointer
189 DEBUGSYM
= -g
-gstabs
190 CFLAGS
= -I.
-I..
/mcp
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) \
191 $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
) -c
192 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
195 ###########################################################################
196 # object files definition
201 COBJS
= AllocBitMap.o \
213 TOBJS
= BetterString-Test.o
215 MCCOBJS
= $(addprefix $(OBJDIR
)/,$(LOBJS
)) $(addprefix $(OBJDIR
)/,$(COBJS
))
216 TESTOBJS
= $(addprefix $(OBJDIR
)/,$(COBJS
)) $(addprefix $(OBJDIR
)/,$(TOBJS
))
218 # different options per target OS
221 ##############################
224 # Compiler/link/strip commands
225 ifneq ($(HOST
), AmigaOS4
)
227 STRIP
= ppc-amigaos-strip
228 OBJDUMP
= ppc-amigaos-objdump
231 # Compiler/Linker flags
234 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
235 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
236 -DNO_PPCINLINE_STDARG
-Wa
,-mregnames
237 LDFLAGS
+= -mcrt
=$(CRT
)
239 # additional object files required
240 M68KSTUBS
= $(OBJDIR
)/mccclass_68k.o
245 ##############################
248 # Compiler/link/strip commands
249 ifneq ($(HOST
), AmigaOS
)
250 CC
= m68k-amigaos-gcc
251 STRIP
= m68k-amigaos-strip
252 OBJDUMP
= m68k-amigaos-objdump
255 # Compiler/Linker flags
256 CPU
= -m68020-60
-msoft-float
257 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
-D__amigaos3__
259 LDLIBS
+= -ldebug
-lmui
261 # additional object files required
267 ##############################
270 # Compiler/link/strip commands
271 ifneq ($(HOST
), MorphOS
)
273 STRIP
= ppc-morphos-strip
274 OBJDUMP
= ppc-morphos-objdump
277 # Compiler/Linker flags
279 CFLAGS
+= -noixemul
-DNO_PPCINLINE_STDARG
284 ifeq ($(OS
), aros-i386
)
286 ##############################
289 ifneq ($(HOST
), AROS
)
291 STRIP
= i386-aros-strip
292 OBJDUMP
= i386-aros-objdump
295 # Compiler/Linker flags
296 OPTFLAGS
= -O2
-fomit-frame-pointer
297 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
298 LDLIBS
+= -larossupport
-lrom
-lmui
301 ifeq ($(OS
), aros-ppc
)
303 ##############################
306 ifneq ($(HOST
), AROS
)
308 STRIP
= ppc-aros-strip
309 OBJDUMP
= ppc-aros-objdump
312 # Compiler/Linker flags
313 OPTFLAGS
= -O2
-fomit-frame-pointer
314 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
315 LDLIBS
+= -larossupport
-lrom
-lmui
318 ifeq ($(OS
), aros-x86_64
)
320 ##############################
323 ifneq ($(HOST
), AROS
)
325 STRIP
= x86_64-aros-strip
326 OBJDUMP
= x86_64-aros-objdump
329 # Compiler/Linker flags
330 OPTFLAGS
= -O2
-fomit-frame-pointer
331 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
332 LDLIBS
+= -larossupport
-lrom
-lmui
343 ifeq ($(wildcard $(DEPFILE
)),$(DEPFILE
))
344 # great, we have a dependecies file, let's make our target
345 all: $(BINDIR
) $(OBJDIR
) $(M68KSTUBS
) $(TARGET
) $(TESTTARGET
)
347 # no dependecies, create it and then call make again
349 @make
--no-print-directory
all
352 # for making a release we compile ALL target with no debug
364 make OS
=aros-i386
clean
365 make OS
=aros-i386 DEBUG
=
367 make OS
=aros-ppc
clean
368 make OS
=aros-ppc DEBUG
=
370 make OS
=aros-x86_64
clean
371 make OS
=aros-x86_64 DEBUG
=
373 # make the object directories
378 # make the binary directories
383 # for compiling single .c files
386 @
$(CC
) $(CFLAGS
) $< -o
$@
388 $(OBJDIR
)/mccclass_68k.o
: ..
/include/mccclass_68k.c
390 @
$(CC
) $(CFLAGS
) $< -o
$@
392 # for linking the target
393 $(TARGET
): $(M68KSTUBS
) $(MCCOBJS
)
395 @
$(CC
) -nostartfiles
$(LDFLAGS
) -o
$@.debug
$(MCCOBJS
) $(M68KSTUBS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
397 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
399 # for linking the target
400 $(TESTTARGET
): $(TESTOBJS
)
402 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(TESTOBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
404 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
408 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
) > $(TARGET
).dump
409 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TESTTARGET
) > $(TESTTARGET
).dump
413 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
414 -$(RM
) $(TESTTARGET
) $(TESTTARGET
).debug
$(TESTTARGET
).map
415 -$(RM
) $(MCCOBJS
) $(TESTOBJS
) $(M68KSTUBS
)
425 @echo
" IN $(TARGET)"
426 @
$(CP
) $(TARGET
) $(DESTDIR
)
430 @echo
"Cleaning targets:"
431 @echo
" clean - Cleanup working directory for clean compile"
432 @echo
" distclean - Also cleanup autogenerated files"
434 @echo
"Other generic targets:"
435 @echo
" all - Build $(TARGET)"
436 @echo
" catalogs - Build all available catalogs"
438 @echo
"Install targets:"
439 @echo
" install - Install $(TARGET) into $(DESTDIR)"
442 @echo
" make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
443 @echo
" make DEBUG= : build $(TARGET) without debugging information"
446 ## DEPENDENCY GENERATION ##############
450 @echo
" MK $(DEPFILE)"
451 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE
)
452 @
$(CC
) -MM
-MG
$(CFLAGS
) $(wildcard *.c
) >>$(DEPFILE
)
453 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE
)
454 @
$(SED
) -i
's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE
)
456 # include dependencies file