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-2009 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 # 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.
23 # $Id: codesets.c 92 2007-12-18 11:37:55Z damato $
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
)
85 #############################################
86 # define common commands we use in this
87 # makefile. Please note that each of them
88 # might be overridden on the commandline.
96 RMDIR
= delete
force all
98 CHMOD
= protect FLAGS
=rwed
110 # override some variables for non-native builds (cross-compiler)
111 ifneq ($(HOST
), AmigaOS
)
112 ifneq ($(HOST
), AmigaOS4
)
113 ifneq ($(HOST
), MorphOS
)
115 # when we end up here this is either a unix or Aros host
116 # so lets use unix kind of commands
130 ###########################################################################
131 # CPU and DEBUG can be defined outside, defaults to above
132 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
135 # OPTFLAGS are disabled by DEBUG normally!
137 # ignored warnings are:
138 # none - because we want to compile with -Wall all the time
147 TARGET
= $(BINDIR
)/libcodesets.a
149 # Common compiler/linker flags
150 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
151 OPTFLAGS
= -O3
-fomit-frame-pointer
-funroll-loops
154 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
)
155 LDFLAGS
= $(CPU
) $(DEBUGSYM
) -nostartfiles
158 # different options per target OS
161 ##############################
164 # Compiler/link/strip commands
165 ifneq ($(HOST
), AmigaOS4
)
167 STRIP
= ppc-amigaos-strip
168 OBJDUMP
= ppc-amigaos-objdump
170 RANLIB
= ppc-amigaos-ranlib
173 # Compiler/Linker flags
176 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
178 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
179 $(REDEFINE
) -Wa
,-mregnames
180 LDFLAGS
+= -mcrt
=$(CRT
)
185 ##############################
188 # Compiler/link/strip commands
189 ifneq ($(HOST
), AmigaOS
)
190 CC
= m68k-amigaos-gcc
191 STRIP
= m68k-amigaos-strip
192 OBJDUMP
= m68k-amigaos-objdump
194 RANLIB
= m68k-amigaos-ranlib
197 # Compiler/Linker flags
198 CPU
= -m68020-60
-msoft-float
206 ##############################
209 # Compiler/link/strip commands
210 ifneq ($(HOST
), MorphOS
)
212 STRIP
= ppc-morphos-strip
213 OBJDUMP
= ppc-morphos-objdump
215 RANLIB
= ppc-morphos-ranlib
218 # Compiler/Linker flags
227 ##############################
230 # Compiler/link/strip commands
231 ifeq ($(TARGET_CPU
),)
234 ifneq ($(HOST
), aros
)
235 CC
= $(TARGET_CPU
)-aros-gcc
236 STRIP
= $(TARGET_CPU
)-aros-strip
237 OBJDUMP
= $(TARGET_CPU
)-aros-objdump
238 AR
= $(TARGET_CPU
)-aros-ar
239 RANLIB
= $(TARGET_CPU
)-aros-ranlib
242 OBJS
= autoinit-aros.o
244 # Compiler/Linker flags
252 ###########################################################################
253 # Here starts all stuff that is common for all target platforms and
261 all: $(BINDIR
) $(OBJDIR
) $(TARGET
)
263 # make the object directories
268 # make the object directories
273 # for compiling single .c files
276 @
$(CC
) $(CFLAGS
) -c
$< -o
$(OBJDIR
)/$@
278 # for linking the target
281 @
$(AR
) -r
$@
$(addprefix $(OBJDIR
)/,$(OBJS
))
284 # for creating a .dump file
287 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
).debug
> $(TARGET
).dump
292 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
$(addprefix $(OBJDIR
)/,$(OBJS
)) $(M68KSTUBS
)
294 # clean all including .obj directory
299 # clean all stuff, including our autotools
304 ## DEPENDENCY GENERATION ##############
307 @echo
"WARNING: Makefile.dep missing. Please run 'make depend'"
311 @echo
" MK Makefile.dep"
312 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >Makefile.dep
313 @
$(CC
) -MM
$(CFLAGS
) $(patsubst %.o
,%.c
, $(OBJS
)) >>Makefile.dep
314 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>Makefile.dep
316 ## DEPENDENCY INCLUDE #################
318 -include Makefile.dep