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
)
79 #############################################
80 # define common commands we use in this
81 # makefile. Please note that each of them
82 # might be overridden on the commandline.
90 RMDIR
= delete
force all
92 CHMOD
= protect FLAGS
=rwed
104 # override some variables for non-native builds (cross-compiler)
105 ifneq ($(HOST
), AmigaOS
)
106 ifneq ($(HOST
), AmigaOS4
)
107 ifneq ($(HOST
), MorphOS
)
109 # when we end up here this is either a unix or Aros host
110 # so lets use unix kind of commands
124 ###########################################################################
125 # CPU and DEBUG can be defined outside, defaults to above
126 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
129 # OPTFLAGS are disabled by DEBUG normally!
131 # ignored warnings are:
132 # none - because we want to compile with -Wall all the time
141 TARGET
= $(BINDIR
)/libopenurl.a
143 # Common compiler/linker flags
144 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
145 OPTFLAGS
= -O3
-fomit-frame-pointer
-funroll-loops
148 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
)
149 LDFLAGS
= $(CPU
) $(DEBUGSYM
) -nostartfiles
152 # different options per target OS
155 ##############################
158 # Compiler/link/strip commands
159 ifneq ($(HOST
), AmigaOS4
)
161 STRIP
= ppc-amigaos-strip
162 OBJDUMP
= ppc-amigaos-objdump
164 RANLIB
= ppc-amigaos-ranlib
167 # Compiler/Linker flags
170 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
172 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
173 $(REDEFINE
) -Wa
,-mregnames
174 LDFLAGS
+= -mcrt
=$(CRT
)
179 ##############################
182 # Compiler/link/strip commands
183 ifneq ($(HOST
), AmigaOS
)
184 CC
= m68k-amigaos-gcc
185 STRIP
= m68k-amigaos-strip
186 OBJDUMP
= m68k-amigaos-objdump
188 RANLIB
= m68k-amigaos-ranlib
191 # Compiler/Linker flags
192 CPU
= -m68020-60
-msoft-float
200 ##############################
203 # Compiler/link/strip commands
204 ifneq ($(HOST
), MorphOS
)
206 STRIP
= ppc-morphos-strip
207 OBJDUMP
= ppc-morphos-objdump
209 RANLIB
= ppc-morphos-ranlib
212 # Compiler/Linker flags
221 ##############################
224 # Compiler/link/strip commands
225 ifeq ($(TARGET_CPU
),)
228 ifneq ($(HOST
), aros
)
229 CC
= $(TARGET_CPU
)-aros-gcc
230 STRIP
= $(TARGET_CPU
)-aros-strip
231 OBJDUMP
= $(TARGET_CPU
)-aros-objdump
232 AR
= $(TARGET_CPU
)-aros-ar
233 RANLIB
= $(TARGET_CPU
)-aros-ranlib
236 OBJS
= autoinit-aros.o
238 # Compiler/Linker flags
246 ###########################################################################
247 # Here starts all stuff that is common for all target platforms and
255 all: $(BINDIR
) $(OBJDIR
) $(TARGET
)
257 # make the object directories
262 # make the object directories
267 # for compiling single .c files
270 @
$(CC
) $(CFLAGS
) -c
$< -o
$(OBJDIR
)/$@
272 # for linking the target
275 @
$(AR
) -r
$@
$(addprefix $(OBJDIR
)/,$(OBJS
))
278 # for creating a .dump file
281 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
).debug
> $(TARGET
).dump
286 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
$(addprefix $(OBJDIR
)/,$(OBJS
)) $(M68KSTUBS
)
288 # clean all including .obj directory
293 # clean all stuff, including our autotools
298 ## DEPENDENCY GENERATION ##############
301 @echo
"WARNING: Makefile.dep missing. Please run 'make depend'"
305 @echo
" MK Makefile.dep"
306 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >Makefile.dep
307 @
$(CC
) -MM
$(CFLAGS
) $(patsubst %.o
,%.c
, $(OBJS
)) >>Makefile.dep
308 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>Makefile.dep
310 ## DEPENDENCY INCLUDE #################
312 -include Makefile.dep