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-2014 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 # Most of the code included in this file was relicensed from GPL to LGPL
20 # from the source code of SimpleMail (http://www.sf.net/projects/simplemail)
21 # with full permissions by its authors.
25 #***************************************************************************/
27 ###########################################################################
28 # This makefile is a very generic one. It tries to identify both, the host
29 # and the target operating system for which YAM should be compiled.
30 # However, this auto-detection can be easily overridden by directly
31 # specifying an option on the commandline while calling 'make'.
35 # # to explicitly compile for AmigaOS3
38 # # to compile for AmigaOS4 but without debugging
39 # > make OS=os4 DEBUG=
42 #############################################
43 # find out the HOST operating system
44 # on which this makefile is run
45 HOST ?
= $(shell uname
)
46 ifeq ($(HOST
), AmigaOS
)
47 ifeq ($(shell uname
-m
), powerpc
)
50 ifeq ($(shell uname
-m
), ppc
)
55 # if no host is identifed (no uname tool)
56 # we assume a AmigaOS build
61 #############################################
62 # now we find out the target OS for
63 # which we are going to compile YAM in case
64 # the caller didn't yet define OS himself
66 ifeq ($(HOST
), AmigaOS4
)
69 ifeq ($(HOST
), AmigaOS
)
72 ifeq ($(HOST
), MorphOS
)
76 # now we find out which CPU system aros will be used
77 ifeq ($(shell uname
-m
), powerpc
)
80 ifeq ($(shell uname
-m
), ppc
)
83 ifeq ($(shell uname
-m
), i386
)
86 ifeq ($(shell uname
-m
), i686
)
89 ifeq ($(shell uname
-m
), x86_64
)
100 #############################################
101 # define common commands we use in this
102 # makefile. Please note that each of them
103 # might be overridden on the commandline.
111 RMDIR
= delete
force all
113 CHMOD
= protect FLAGS
=rwed
122 # override some variables for non-native builds (cross-compiler)
123 ifneq ($(HOST
), AmigaOS
)
124 ifneq ($(HOST
), AmigaOS4
)
125 ifneq ($(HOST
), MorphOS
)
127 # when we end up here this is either a unix or Aros host
128 # so lets use unix kind of commands
141 ###########################################################################
142 # CPU and DEBUG can be defined outside, defaults to above
143 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
146 # OPTFLAGS are disabled by DEBUG normally!
148 # ignored warnings are:
149 # none - because we want to compile with -Wall all the time
158 TARGET
= $(BINDIR
)/b64d \
160 $(BINDIR
)/UTF8ToStrHook \
161 $(BINDIR
)/DetectCodeset \
165 # Common compiler/linker flags
166 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
167 OPTFLAGS
= -O3
-fomit-frame-pointer
-funroll-loops
169 DEBUGSYM
= -g
-gstabs
170 CFLAGS
= -I.
-I..
/include -I..
/..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
)
171 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
174 # different options per target OS
177 ##############################
180 # Compiler/link/strip commands
181 ifneq ($(HOST
), AmigaOS4
)
183 STRIP
= ppc-amigaos-strip
184 OBJDUMP
= ppc-amigaos-objdump
187 # Compiler/Linker flags
190 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
192 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
193 $(REDEFINE
) -Wa
,-mregnames
194 LDFLAGS
+= -mcrt
=$(CRT
)
199 ##############################
202 # Compiler/link/strip commands
203 ifneq ($(HOST
), AmigaOS
)
204 CC
= m68k-amigaos-gcc
205 STRIP
= m68k-amigaos-strip
206 OBJDUMP
= m68k-amigaos-objdump
209 # Compiler/Linker flags
210 CPU
= -m68020-60
-msoft-float
213 LDLIBS
+= -ldebug
-lmui
214 NOINLINE
= -DNO_INLINE_STDARG
219 ##############################
222 # Compiler/link/strip commands
223 ifneq ($(HOST
), MorphOS
)
225 STRIP
= ppc-morphos-strip
226 OBJDUMP
= ppc-morphos-objdump
229 # Compiler/Linker flags
231 CFLAGS
+= -noixemul
-DUSE_INLINE_STDARG
234 NOINLINE
= -DNO_PPCINLINE_STDARG
237 ifeq ($(OS
), aros-i386
)
239 ##############################
242 ifneq ($(HOST
), AROS
)
244 STRIP
= i386-aros-strip
245 OBJDUMP
= i386-aros-objdump
248 # Compiler/Linker flags
249 OPTFLAGS
= -O2
-fomit-frame-pointer
-funroll-loops
250 CFLAGS
+= -Wno-pointer-sign
254 ifeq ($(OS
), aros-ppc
)
256 ##############################
259 ifneq ($(HOST
), AROS
)
261 STRIP
= ppc-aros-strip
262 OBJDUMP
= ppc-aros-objdump
265 # Compiler/Linker flags
266 OPTFLAGS
= -O2
-fomit-frame-pointer
-funroll-loops
267 CFLAGS
+= -Wno-pointer-sign
271 ifeq ($(OS
), aros-x86_64
)
273 ##############################
276 ifneq ($(HOST
), AROS
)
278 STRIP
= x86_64-aros-strip
279 OBJDUMP
= x86_64-aros-objdump
282 # Compiler/Linker flags
283 OPTFLAGS
= -O2
-fomit-frame-pointer
-funroll-loops
284 CFLAGS
+= -Wno-pointer-sign
294 ###########################################################################
295 # Here starts all stuff that is common for all target platforms and
300 all: $(BINDIR
) $(OBJDIR
) $(TARGET
)
302 # for making a release we compile ALL target with no debug
314 make OS
=aros-i386
clean
315 make OS
=aros-i386 DEBUG
=
317 make OS
=aros-ppc
clean
318 make OS
=aros-ppc DEBUG
=
320 make OS
=aros-x86_64
clean
321 make OS
=aros-x86_64 DEBUG
=
323 # make the object directories
328 # make the object directories
333 # for compiling single .c files
336 @
$(CC
) $(CFLAGS
) -c
$< -o
$@
338 # for linking the target
339 $(BINDIR
)/b64d
: $(OBJDIR
)/b64d.o
341 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$< $(LDLIBS
)
342 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
345 $(BINDIR
)/b64e
: $(OBJDIR
)/b64e.o
347 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$< $(LDLIBS
)
348 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
351 $(BINDIR
)/UTF8ToStrHook
: $(OBJDIR
)/UTF8ToStrHook.o
353 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$< $(LDLIBS
)
354 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
357 $(BINDIR
)/DetectCodeset
: $(OBJDIR
)/DetectCodeset.o
359 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$< $(LDLIBS
)
360 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
362 $(BINDIR
)/demo1
: demo1.c vastubs.c
364 @
$(CC
) $(CFLAGS
) $(NOINLINE
) -c demo1.c
-o
$(OBJDIR
)/demo1.o
365 @echo
" CC vastubs.c"
366 @
$(CC
) $(CFLAGS
) $(NOINLINE
) -c vastubs.c
-o
$(OBJDIR
)/vastubs.o
368 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(OBJDIR
)/demo1.o
$(OBJDIR
)/vastubs.o
$(LDLIBS
)
369 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
372 $(BINDIR
)/Convert
: $(OBJDIR
)/Convert.o
374 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$< $(LDLIBS
)
375 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
381 -$(RM
) $(TARGET
) $(OBJDIR
)/*.o
383 # clean all including .obj directory
388 # clean all stuff, including our autotools