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
118 # override some variables for non-native builds (cross-compiler)
119 ifneq ($(HOST
), AmigaOS
)
120 ifneq ($(HOST
), AmigaOS4
)
121 ifneq ($(HOST
), MorphOS
)
123 # when we end up here this is either a unix or Aros host
124 # so lets use unix kind of commands
138 ###########################################################################
139 # CPU and DEBUG can be defined outside, defaults to above
140 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
143 # OPTFLAGS are disabled by DEBUG normally!
145 # ignored warnings are:
146 # none - because we want to compile with -Wall all the time
154 DEPFILE
= Makefile.dep
157 TARGET
= $(BINDIR
)/OpenURL
159 # Common compiler/linker flags
160 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
161 OPTFLAGS
= -O3
-fomit-frame-pointer
163 DEBUGSYM
= -g
-gstabs
164 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
)
165 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
168 # different options per target OS
171 ##############################
174 # Compiler/link/strip commands
175 ifneq ($(HOST
), AmigaOS4
)
177 STRIP
= ppc-amigaos-strip
178 OBJDUMP
= ppc-amigaos-objdump
181 # Compiler/Linker flags
184 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
186 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
187 $(REDEFINE
) -Wa
,-mregnames
188 LDFLAGS
+= -mcrt
=$(CRT
)
193 ##############################
196 # Compiler/link/strip commands
197 ifneq ($(HOST
), AmigaOS
)
198 CC
= m68k-amigaos-gcc
199 STRIP
= m68k-amigaos-strip
200 OBJDUMP
= m68k-amigaos-objdump
203 # Compiler/Linker flags
204 CPU
= -m68020-60
-msoft-float
205 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
212 ##############################
215 # Compiler/link/strip commands
216 ifneq ($(HOST
), MorphOS
)
218 STRIP
= ppc-morphos-strip
219 OBJDUMP
= ppc-morphos-objdump
222 # Compiler/Linker flags
229 ifeq ($(OS
), aros-i386
)
231 ##############################
234 ifneq ($(HOST
), AROS
)
236 STRIP
= i386-aros-strip
237 OBJDUMP
= i386-aros-objdump
240 # Compiler/Linker flags
241 OPTFLAGS
= -O2
-fomit-frame-pointer
242 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
243 LDLIBS
+= -larossupport
-lrom
246 ifeq ($(OS
), aros-ppc
)
248 ##############################
251 ifneq ($(HOST
), AROS
)
253 STRIP
= ppc-aros-strip
254 OBJDUMP
= ppc-aros-objdump
257 # Compiler/Linker flags
258 OPTFLAGS
= -O2
-fomit-frame-pointer
259 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
260 LDLIBS
+= -larossupport
-lrom
263 ifeq ($(OS
), aros-x86_64
)
265 ##############################
268 ifneq ($(HOST
), AROS
)
270 STRIP
= x86_64-aros-strip
271 OBJDUMP
= x86_64-aros-objdump
274 # Compiler/Linker flags
275 OPTFLAGS
= -O2
-fomit-frame-pointer
276 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
277 LDLIBS
+= -larossupport
-lrom
286 ###########################################################################
287 # Here starts all stuff that is common for all target platforms and
296 ifeq ($(wildcard $(DEPFILE
)),$(DEPFILE
))
297 # great, we have a dependecies file, let's make our target
298 all: $(BINDIR
) $(OBJDIR
) $(TARGET
)
300 # no dependecies, create it and then call make again
302 @make
--no-print-directory
all
305 # make the object directories
310 # make the object directories
315 # for compiling single .c files
318 @
$(CC
) $(CFLAGS
) -c
$< -o
$@
320 # for linking the target
321 $(TARGET
): $(addprefix $(OBJDIR
)/,$(OBJS
))
323 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(addprefix $(OBJDIR
)/,$(OBJS
)) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
325 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
328 # for creating a .dump file
331 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
).debug
> $(TARGET
).dump
336 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
$(addprefix $(OBJDIR
)/,$(OBJS
))
338 # clean all including .obj directory
343 # clean all stuff, including our autotools
348 #install the newly built library to LIBS:
351 -$(CP
) $(TARGET
) LIBS
:
353 ## DEPENDENCY GENERATION ##############
356 @echo
"WARNING: $(DEPFILE) missing. Please run 'make depend'"
358 ## DEPENDENCY GENERATION ##############
362 @echo
" MK $(DEPFILE)"
363 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE
)
364 @
$(CC
) -MM
-MG
$(CFLAGS
) $(wildcard *.c
) >>$(DEPFILE
)
365 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE
)
366 @
$(SED
) -i
's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE
)
368 # include dependencies file