revert between 56095 -> 55830 in arch
[AROS.git] / external / openurl / libopenurl / Makefile
blob61a44b2e0d90328ee3be1b56bfad18f442981a4d
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 # now we find out which CPU system aros will be used
71 ifeq ($(shell uname -m), powerpc)
72 OS = aros-ppc
73 endif
74 ifeq ($(shell uname -m), ppc)
75 OS = aros-ppc
76 endif
77 ifeq ($(shell uname -m), i386)
78 OS = aros-i386
79 endif
80 ifeq ($(shell uname -m), i686)
81 OS = aros-i686
82 endif
83 ifeq ($(shell uname -m), x86_64)
84 OS = aros-x86_64
85 endif
86 else
87 OS = os4
88 endif
89 endif
90 endif
91 endif
92 endif
94 #############################################
95 # define common commands we use in this
96 # makefile. Please note that each of them
97 # might be overridden on the commandline.
99 # common commands
100 FLEX = flex
101 FC = flexcat
102 EXPR = expr
103 DATE = date
104 RM = delete force
105 RMDIR = delete force all
106 MKDIR = makedir
107 CHMOD = protect FLAGS=rwed
108 CP = copy
109 CC = gcc
110 STRIP = strip
111 OBJDUMP = objdump
112 AR = ar
113 RANLIB = ranlib
115 # path definitions
116 CDUP = /
117 CDTHIS=
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
126 RM = rm -f
127 RMDIR = rm -rf
128 MKDIR = mkdir -p
129 CHMOD = chmod 755
130 CP = cp -f
132 CDUP = ../
133 CDTHIS= ./
135 endif
136 endif
137 endif
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
142 # PPC-603e version
144 # OPTFLAGS are disabled by DEBUG normally!
146 # ignored warnings are:
147 # none - because we want to compile with -Wall all the time
149 # Common Directories
150 PREFIX = $(CDTHIS)
151 OBJDIR = .obj_$(OS)
152 BINDIR = bin_$(OS)
153 VPATH = $(OBJDIR)
155 # target definition
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
161 DEBUG = -DDEBUG -O0
162 DEBUGSYM = -g -gstabs
163 CFLAGS = -I. -I../include $(CPU) $(WARN) $(OPTFLAGS) $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS)
164 LDFLAGS = $(CPU) $(DEBUGSYM) -nostartfiles
165 LDLIBS =
167 # different options per target OS
168 ifeq ($(OS), os4)
170 ##############################
171 # AmigaOS4
173 # Compiler/link/strip commands
174 ifneq ($(HOST), AmigaOS4)
175 CC = ppc-amigaos-gcc
176 STRIP = ppc-amigaos-strip
177 OBJDUMP = ppc-amigaos-objdump
178 AR = ppc-amigaos-ar
179 RANLIB = ppc-amigaos-ranlib
180 endif
182 # Compiler/Linker flags
183 CRT = newlib
184 CPU = -mcpu=powerpc
185 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
186 REDEFINE =
187 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
188 $(REDEFINE) -Wa,-mregnames
189 LDFLAGS += -mcrt=$(CRT)
191 else
192 ifeq ($(OS), os3)
194 ##############################
195 # AmigaOS3
197 # Compiler/link/strip commands
198 ifneq ($(HOST), AmigaOS)
199 CC = m68k-amigaos-gcc
200 STRIP = m68k-amigaos-strip
201 OBJDUMP = m68k-amigaos-objdump
202 AR = m68k-amigaos-ar
203 RANLIB = m68k-amigaos-ranlib
204 endif
206 # Compiler/Linker flags
207 CPU = -m68020-60 -msoft-float
208 CFLAGS += -noixemul
209 LDFLAGS += -noixemul
210 LDLIBS += -ldebug
212 else
213 ifeq ($(OS), mos)
215 ##############################
216 # MorphOS
218 # Compiler/link/strip commands
219 ifneq ($(HOST), MorphOS)
220 CC = ppc-morphos-gcc
221 STRIP = ppc-morphos-strip
222 OBJDUMP = ppc-morphos-objdump
223 AR = ppc-morphos-ar
224 RANLIB = ppc-morphos-ranlib
225 endif
227 # Compiler/Linker flags
228 CPU = -mcpu=powerpc
229 CFLAGS += -noixemul
230 LDFLAGS += -noixemul
231 LDLIBS += -ldebug
233 else
234 ifeq ($(OS), aros-i386)
236 ##############################
237 # AROS (i386)
239 ifneq ($(HOST), AROS)
240 CC = i386-aros-gcc
241 STRIP = i386-aros-strip
242 OBJDUMP = i386-aros-objdump
243 AR = i386-aros-ar
244 RANLIB = i386-aros-ranlib
246 endif
248 OBJS = autoinit-aros.o
250 # Compiler/Linker flags
251 OPTFLAGS = -O2 -fomit-frame-pointer
252 CFLAGS += -Wno-pointer-sign
253 LDLIBS += -lrom
255 else
256 ifeq ($(OS), aros-ppc)
258 ##############################
259 # AROS (PPC)
261 ifneq ($(HOST), AROS)
262 CC = ppc-aros-gcc
263 STRIP = ppc-aros-strip
264 OBJDUMP = ppc-aros-objdump
265 AR = ppc-aros-ar
266 RANLIB = ppc-aros-ranlib
267 endif
269 # Compiler/Linker flags
270 OPTFLAGS = -O2 -fomit-frame-pointer
271 CFLAGS += -Wno-pointer-sign
272 LDLIBS += -lrom
274 else
275 ifeq ($(OS), aros-x86_64)
277 ##############################
278 # AROS (x86_64)
280 ifneq ($(HOST), AROS)
281 CC = x86_64-aros-gcc
282 STRIP = x86_64-aros-strip
283 OBJDUMP = x86_64-aros-objdump
284 AR = x86_64-ar
285 RANLIB = x86_64-ranlib
286 endif
288 # Compiler/Linker flags
289 OPTFLAGS = -O2 -fomit-frame-pointer
290 CFLAGS += -Wno-pointer-sign
291 LDLIBS += -lrom
293 endif
294 endif
295 endif
296 endif
297 endif
298 endif
300 ###########################################################################
301 # Here starts all stuff that is common for all target platforms and
302 # hosts.
304 # TODO: add stubs
305 # OBJS +=
307 # main target
308 .PHONY: all
309 all: $(BINDIR) $(OBJDIR) $(TARGET)
311 # make the object directories
312 $(OBJDIR):
313 @echo " MK $@"
314 @$(MKDIR) $(OBJDIR)
316 # make the object directories
317 $(BINDIR):
318 @echo " MK $@"
319 @$(MKDIR) $(BINDIR)
321 # for compiling single .c files
322 %.o: %.c
323 @echo " CC $<"
324 @$(CC) $(CFLAGS) -c $< -o $(OBJDIR)/$@
326 # for linking the target
327 $(TARGET): $(OBJS)
328 @echo " AR $@"
329 @$(AR) -r $@ $(addprefix $(OBJDIR)/,$(OBJS))
330 @$(RANLIB) $@
332 # for creating a .dump file
333 .PHONY: dump
334 dump:
335 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET).debug > $(TARGET).dump
337 # cleanup target
338 .PHONY: clean
339 clean:
340 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map $(addprefix $(OBJDIR)/,$(OBJS)) $(M68KSTUBS)
342 # clean all including .obj directory
343 .PHONY: cleanall
344 cleanall: clean
345 -$(RMDIR) $(OBJDIR)
347 # clean all stuff, including our autotools
348 .PHONY: distclean
349 distclean: cleanall
350 -$(RMDIR) $(BINDIR)
352 ## DEPENDENCY GENERATION ##############
354 Makefile.dep: ;
355 @echo "WARNING: Makefile.dep missing. Please run 'make depend'"
357 .PHONY: depend
358 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