define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / workbench / libs / openurl / libopenurl / Makefile
blobb5174a36bfc2b8bd64a02f4f7fde132aa5112c83
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/
17 # $Id$
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'.
27 # Example:
29 # # to explicitly compile for AmigaOS3
30 # > make OS=os3
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)
42 HOST = AmigaOS4
43 endif
44 ifeq ($(shell uname -m), ppc)
45 HOST = AmigaOS4
46 endif
47 endif
49 # if no host is identifed (no uname tool)
50 # we assume a AmigaOS build
51 ifeq ($(HOST),)
52 HOST = AmigaOS
53 endif
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
59 ifndef (OS)
60 ifeq ($(HOST), AmigaOS4)
61 OS = os4
62 else
63 ifeq ($(HOST), AmigaOS)
64 OS = os3
65 else
66 ifeq ($(HOST), MorphOS)
67 OS = mos
68 else
69 ifeq ($(HOST), Aros)
70 OS = aros
71 else
72 OS = os4
73 endif
74 endif
75 endif
76 endif
77 endif
79 #############################################
80 # define common commands we use in this
81 # makefile. Please note that each of them
82 # might be overridden on the commandline.
84 # common commands
85 FLEX = flex
86 FC = flexcat
87 EXPR = expr
88 DATE = date
89 RM = delete force
90 RMDIR = delete force all
91 MKDIR = makedir
92 CHMOD = protect FLAGS=rwed
93 CP = copy
94 CC = gcc
95 STRIP = strip
96 OBJDUMP = objdump
97 AR = ar
98 RANLIB = ranlib
100 # path definitions
101 CDUP = /
102 CDTHIS=
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
111 RM = rm -f
112 RMDIR = rm -rf
113 MKDIR = mkdir -p
114 CHMOD = chmod 755
115 CP = cp -f
117 CDUP = ../
118 CDTHIS= ./
120 endif
121 endif
122 endif
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
127 # PPC-603e version
129 # OPTFLAGS are disabled by DEBUG normally!
131 # ignored warnings are:
132 # none - because we want to compile with -Wall all the time
134 # Common Directories
135 PREFIX = $(CDTHIS)
136 OBJDIR = .obj_$(OS)
137 BINDIR = bin_$(OS)
138 VPATH = $(OBJDIR)
140 # target definition
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
146 DEBUG = -DDEBUG -O0
147 DEBUGSYM = -gstabs
148 CFLAGS = -I. -I../include $(CPU) $(WARN) $(OPTFLAGS) $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS)
149 LDFLAGS = $(CPU) $(DEBUGSYM) -nostartfiles
150 LDLIBS =
152 # different options per target OS
153 ifeq ($(OS), os4)
155 ##############################
156 # AmigaOS4
158 # Compiler/link/strip commands
159 ifneq ($(HOST), AmigaOS4)
160 CC = ppc-amigaos-gcc
161 STRIP = ppc-amigaos-strip
162 OBJDUMP = ppc-amigaos-objdump
163 AR = ppc-amigaos-ar
164 RANLIB = ppc-amigaos-ranlib
165 endif
167 # Compiler/Linker flags
168 CRT = newlib
169 CPU = -mcpu=powerpc
170 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
171 REDEFINE =
172 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
173 $(REDEFINE) -Wa,-mregnames
174 LDFLAGS += -mcrt=$(CRT)
176 else
177 ifeq ($(OS), os3)
179 ##############################
180 # AmigaOS3
182 # Compiler/link/strip commands
183 ifneq ($(HOST), AmigaOS)
184 CC = m68k-amigaos-gcc
185 STRIP = m68k-amigaos-strip
186 OBJDUMP = m68k-amigaos-objdump
187 AR = m68k-amigaos-ar
188 RANLIB = m68k-amigaos-ranlib
189 endif
191 # Compiler/Linker flags
192 CPU = -m68020-60 -msoft-float
193 CFLAGS += -noixemul
194 LDFLAGS += -noixemul
195 LDLIBS += -ldebug
197 else
198 ifeq ($(OS), mos)
200 ##############################
201 # MorphOS
203 # Compiler/link/strip commands
204 ifneq ($(HOST), MorphOS)
205 CC = ppc-morphos-gcc
206 STRIP = ppc-morphos-strip
207 OBJDUMP = ppc-morphos-objdump
208 AR = ppc-morphos-ar
209 RANLIB = ppc-morphos-ranlib
210 endif
212 # Compiler/Linker flags
213 CPU = -mcpu=powerpc
214 CFLAGS += -noixemul
215 LDFLAGS += -noixemul
216 LDLIBS += -ldebug
218 else
219 ifeq ($(OS), aros)
221 ##############################
222 # AROS
224 # Compiler/link/strip commands
225 ifeq ($(TARGET_CPU),)
226 TARGET_CPU = i386
227 endif
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
234 endif
236 OBJS = autoinit-aros.o
238 # Compiler/Linker flags
239 LDLIBS += -lrom
241 endif
242 endif
243 endif
244 endif
246 ###########################################################################
247 # Here starts all stuff that is common for all target platforms and
248 # hosts.
250 # TODO: add stubs
251 # OBJS +=
253 # main target
254 .PHONY: all
255 all: $(BINDIR) $(OBJDIR) $(TARGET)
257 # make the object directories
258 $(OBJDIR):
259 @echo " MK $@"
260 @$(MKDIR) $(OBJDIR)
262 # make the object directories
263 $(BINDIR):
264 @echo " MK $@"
265 @$(MKDIR) $(BINDIR)
267 # for compiling single .c files
268 %.o: %.c
269 @echo " CC $<"
270 @$(CC) $(CFLAGS) -c $< -o $(OBJDIR)/$@
272 # for linking the target
273 $(TARGET): $(OBJS)
274 @echo " AR $@"
275 @$(AR) -r $@ $(addprefix $(OBJDIR)/,$(OBJS))
276 @$(RANLIB) $@
278 # for creating a .dump file
279 .PHONY: dump
280 dump:
281 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET).debug > $(TARGET).dump
283 # cleanup target
284 .PHONY: clean
285 clean:
286 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map $(addprefix $(OBJDIR)/,$(OBJS)) $(M68KSTUBS)
288 # clean all including .obj directory
289 .PHONY: cleanall
290 cleanall: clean
291 -$(RMDIR) $(OBJDIR)
293 # clean all stuff, including our autotools
294 .PHONY: distclean
295 distclean: cleanall
296 -$(RMDIR) $(BINDIR)
298 ## DEPENDENCY GENERATION ##############
300 Makefile.dep: ;
301 @echo "WARNING: Makefile.dep missing. Please run 'make depend'"
303 .PHONY: depend
304 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