1 #/***************************************************************************
3 # codesets.library - Amiga shared library for handling different codesets
4 # Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
5 # Copyright (C) 2005-2007 by codesets.library 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 # codesets.library project: http://sourceforge.net/projects/codesetslib/
19 # $Id: makefile.os4 62 2007-01-23 08:55:18Z damato $
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
43 ifeq ($(HOST
), AmigaOS
)
44 ifeq ($(shell uname
-m
), powerpc
)
47 ifeq ($(shell uname
-m
), ppc
)
53 #############################################
54 # now we find out the target OS for
55 # which we are going to compile YAM in case
56 # the caller didn't yet define OS himself
58 ifeq ($(HOST
), AmigaOS4
)
61 ifeq ($(HOST
), AmigaOS
)
64 ifeq ($(HOST
), MorphOS
)
77 #############################################
78 # define common commands we use in this
79 # makefile. Please note that each of them
80 # might be overridden on the commandline.
93 # override commands for native builds
94 ifeq ($(HOST
), AmigaOS4
)
97 RMDIR
= delete
force all
101 ifeq ($(HOST
), AmigaOS
)
104 RMDIR
= delete
force all
107 ifeq ($(HOST
), MorphOS
)
110 RMDIR
= delete
force all
116 ###########################################################################
117 # CPU and DEBUG can be defined outside, defaults to above
118 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
121 # OPTFLAGS are disabled by DEBUG normally!
123 # ignored warnings are:
124 # none - because we want to compile with -Wall all the time
132 TARGET
= $(BINDIR
)/codesets.library
134 # Common compiler/linker flags
135 WARN
= -W
-Wall
-Wwrite-strings
136 OPTFLAGS
= -O3
-fomit-frame-pointer
-funroll-loops
139 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) \
140 $(DEBUG
) $(DEBUGSYM
) -c
141 LDFLAGS
= $(CPU
) $(DEBUGSYM
) -nostartfiles
144 # different options per target OS
147 ##############################
150 # Compiler/link/strip commands
152 STRIP
= ppc-amigaos-strip
153 OBJDUMP
= ppc-amigaos-objdump
155 # Compiler/Linker flags
158 REDEFINE
= -DCoerceMethod
=ICoerceMethod
-DDoMethod
=IDoMethod \
159 -DDoSuperMethod
=IDoSuperMethod
-DDoSuperMethodA
=IDoSuperMethodA
160 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
161 $(REDEFINE
) -Wa
,-mregnames
162 LDFLAGS
+= -mcrt
=$(CRT
)
164 # additional object files required
165 M68KSTUBS
= $(OBJDIR
)/codesets_68k.o
170 ##############################
173 # Compiler/link/strip commands
174 CC
= m68k-amigaos-gcc
175 STRIP
= m68k-amigaos-strip
176 OBJDUMP
= m68k-amigaos-objdump
178 # Compiler/Linker flags
179 CPU
= -m68020-60
-msoft-float
187 ##############################
190 # Compiler/link/strip commands
192 STRIP
= ppc-morphos-strip
193 OBJDUMP
= ppc-morphos-objdump
195 # Compiler/Linker flags
204 ##############################
207 # Compiler/link/strip commands
209 STRIP
= i686-aros-strip
210 OBJDUMP
= i686-aros-objdump
212 # Compiler/Linker flags
220 ###########################################################################
221 # Here starts all stuff that is common for all target platforms and
224 OBJS
= $(OBJDIR
)/libinit.o \
228 $(OBJDIR
)/convertUTF.o \
229 $(OBJDIR
)/codesets.o \
233 all: $(BINDIR
) $(OBJDIR
) $(TARGET
)
235 # make the object directories
237 @printf
'\033[33mGenerating $@ directory\033[0m\n'
240 # make the binary directories
242 @printf
'\033[33mGenerating $@ directory\033[0m\n'
248 @printf
'\033[32mCompiling $<\033[0m\n'
249 @
$(CC
) $(CFLAGS
) $< -o
$@
251 $(OBJDIR
)/codesets_68k.o
: ..
/include/codesets_68k.c
252 @printf
'\033[32mCompiling $<\033[0m\n'
253 @
$(CC
) $(CFLAGS
) $< -o
$@
257 $(TARGET
): $(M68KSTUBS
) $(OBJS
)
258 @printf
'\033[32mLinking \033[1m$@\033[0m\n'
259 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(OBJS
) $(M68KSTUBS
) $(LDLIBS
) -Wl
,-Map
,$@.map
260 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
266 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
$(OBJS
) $(M68KSTUBS
)
275 $(OBJDIR
)/libinit.o
: libinit.c lib.h version.h base.h macros.h lib_protos.h
276 $(OBJDIR
)/init.o
: init.c lib.h base.h macros.h lib_protos.h
277 $(OBJDIR
)/utils.o
: utils.c lib.h base.h macros.h lib_protos.h
278 $(OBJDIR
)/base64.o
: base64.c lib.h base.h macros.h lib_protos.h
279 $(OBJDIR
)/convertUTF.o
: convertUTF.c lib.h convertUTF.h base.h macros.h lib_protos.h
280 $(OBJDIR
)/codesets.o
: codesets.c lib.h codesets_table.h convertUTF.h base.h macros.h lib_protos.h
281 $(OBJDIR
)/debug.o
: debug.c lib.h version.h