1 #/***************************************************************************
3 # openurl.library - universal URL display and browser launcher library
4 # Copyright (C) 1998-2005 by Troels Walsted Hansen, et al.
5 # Copyright (C) 2005-2009 by openurl.library Open Source Team
7 # This library is free software; it has been placed in the public domain
8 # and you can freely redistribute it and/or modify it. Please note, however,
9 # that some components may be under the LGPL or GPL license.
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.
15 # openurl.library project: http://sourceforge.net/projects/openurllib/
19 #***************************************************************************/
21 ###########################################################################
22 # This makefile is a very generic one. It tries to identify both, the host
23 # and the target operating system for which YAM should be compiled.
24 # However, this auto-detection can be easily overridden by directly
25 # specifying an option on the commandline while calling 'make'.
29 # # to explicitly compile for AmigaOS3
32 # # to compile for AmigaOS4 but without debugging
33 # > make OS=os4 DEBUG=
36 #############################################
37 # find out the HOST operating system
38 # on which this makefile is run
39 HOST ?
= $(shell uname
)
40 ifeq ($(HOST
), AmigaOS
)
41 ifeq ($(shell uname
-m
), powerpc
)
44 ifeq ($(shell uname
-m
), ppc
)
49 # if no host is identifed (no uname tool)
50 # we assume a AmigaOS build
55 #############################################
56 # now we find out the target OS for
57 # which we are going to compile YAM in case
58 # the caller didn't yet define OS himself
60 ifeq ($(HOST
), AmigaOS4
)
63 ifeq ($(HOST
), AmigaOS
)
66 ifeq ($(HOST
), MorphOS
)
70 # now we find out which CPU system aros will be used
71 ifeq ($(shell uname
-m
), powerpc
)
74 ifeq ($(shell uname
-m
), ppc
)
77 ifeq ($(shell uname
-m
), i386
)
80 ifeq ($(shell uname
-m
), i686
)
83 ifeq ($(shell uname
-m
), x86_64
)
94 #############################################
95 # define common commands we use in this
96 # makefile. Please note that each of them
97 # might be overridden on the commandline.
105 RMDIR
= delete
force all
107 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
156 TARGET
= $(BINDIR
)/libopenurl.a
158 # Common compiler/linker flags
159 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
160 OPTFLAGS
= -O3
-fomit-frame-pointer
162 DEBUGSYM
= -g
-gstabs
163 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
)
164 LDFLAGS
= $(CPU
) $(DEBUGSYM
) -nostartfiles
167 # different options per target OS
170 ##############################
173 # Compiler/link/strip commands
174 ifneq ($(HOST
), AmigaOS4
)
176 STRIP
= ppc-amigaos-strip
177 OBJDUMP
= ppc-amigaos-objdump
179 RANLIB
= ppc-amigaos-ranlib
182 # Compiler/Linker flags
185 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
187 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
188 $(REDEFINE
) -Wa
,-mregnames
189 LDFLAGS
+= -mcrt
=$(CRT
)
194 ##############################
197 # Compiler/link/strip commands
198 ifneq ($(HOST
), AmigaOS
)
199 CC
= m68k-amigaos-gcc
200 STRIP
= m68k-amigaos-strip
201 OBJDUMP
= m68k-amigaos-objdump
203 RANLIB
= m68k-amigaos-ranlib
206 # Compiler/Linker flags
207 CPU
= -m68020-60
-msoft-float
215 ##############################
218 # Compiler/link/strip commands
219 ifneq ($(HOST
), MorphOS
)
221 STRIP
= ppc-morphos-strip
222 OBJDUMP
= ppc-morphos-objdump
224 RANLIB
= ppc-morphos-ranlib
227 # Compiler/Linker flags
234 ifeq ($(OS
), aros-i386
)
236 ##############################
239 ifneq ($(HOST
), AROS
)
241 STRIP
= i386-aros-strip
242 OBJDUMP
= i386-aros-objdump
244 RANLIB
= i386-aros-ranlib
248 OBJS
= autoinit-aros.o
250 # Compiler/Linker flags
251 OPTFLAGS
= -O2
-fomit-frame-pointer
252 CFLAGS
+= -Wno-pointer-sign
256 ifeq ($(OS
), aros-ppc
)
258 ##############################
261 ifneq ($(HOST
), AROS
)
263 STRIP
= ppc-aros-strip
264 OBJDUMP
= ppc-aros-objdump
266 RANLIB
= ppc-aros-ranlib
269 # Compiler/Linker flags
270 OPTFLAGS
= -O2
-fomit-frame-pointer
271 CFLAGS
+= -Wno-pointer-sign
275 ifeq ($(OS
), aros-x86_64
)
277 ##############################
280 ifneq ($(HOST
), AROS
)
282 STRIP
= x86_64-aros-strip
283 OBJDUMP
= x86_64-aros-objdump
285 RANLIB
= x86_64-ranlib
288 # Compiler/Linker flags
289 OPTFLAGS
= -O2
-fomit-frame-pointer
290 CFLAGS
+= -Wno-pointer-sign
300 ###########################################################################
301 # Here starts all stuff that is common for all target platforms and
309 all: $(BINDIR
) $(OBJDIR
) $(TARGET
)
311 # make the object directories
316 # make the object directories
321 # for compiling single .c files
324 @
$(CC
) $(CFLAGS
) -c
$< -o
$(OBJDIR
)/$@
326 # for linking the target
329 @
$(AR
) -r
$@
$(addprefix $(OBJDIR
)/,$(OBJS
))
332 # for creating a .dump file
335 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
).debug
> $(TARGET
).dump
340 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
$(addprefix $(OBJDIR
)/,$(OBJS
)) $(M68KSTUBS
)
342 # clean all including .obj directory
347 # clean all stuff, including our autotools
352 ## DEPENDENCY GENERATION ##############
355 @echo
"WARNING: Makefile.dep missing. Please run 'make depend'"
359 @echo
" MK Makefile.dep"
360 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >Makefile.dep
361 @
$(CC
) -MM
$(CFLAGS
) $(patsubst %.o
,%.c
, $(OBJS
)) >>Makefile.dep
362 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>Makefile.dep
364 ## DEPENDENCY INCLUDE #################
366 -include Makefile.dep