alsa.audio: add additional read cycle if there is more than 20ms space in buffer
[AROS.git] / external / openurl / cmd / Makefile
blob913589a818cf21927daf9ddbb0cf5326dcef3707
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 SED = sed
109 CP = copy
110 CC = gcc
111 STRIP = strip
112 OBJDUMP = objdump
114 # path definitions
115 CDUP = /
116 CDTHIS=
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
125 RM = rm -f
126 RMDIR = rm -rf
127 MKDIR = mkdir -p
128 CHMOD = chmod 755
129 CP = cp -f
131 CDUP = ../
132 CDTHIS= ./
134 endif
135 endif
136 endif
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
141 # PPC-603e version
143 # OPTFLAGS are disabled by DEBUG normally!
145 # ignored warnings are:
146 # none - because we want to compile with -Wall all the time
148 # Common Directories
149 PREFIX = $(CDTHIS)
150 OBJDIR = .obj_$(OS)
151 BINDIR = bin_$(OS)
152 LOCALE = ../locale
153 VPATH = $(OBJDIR)
154 DEPFILE = Makefile.dep
156 # target definition
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
162 DEBUG = -DDEBUG -O0
163 DEBUGSYM = -g -gstabs
164 CFLAGS = -I. -I../include $(CPU) $(WARN) $(OPTFLAGS) $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS)
165 LDFLAGS = $(CPU) $(DEBUGSYM)
166 LDLIBS =
168 # different options per target OS
169 ifeq ($(OS), os4)
171 ##############################
172 # AmigaOS4
174 # Compiler/link/strip commands
175 ifneq ($(HOST), AmigaOS4)
176 CC = ppc-amigaos-gcc
177 STRIP = ppc-amigaos-strip
178 OBJDUMP = ppc-amigaos-objdump
179 endif
181 # Compiler/Linker flags
182 CRT = newlib
183 CPU = -mcpu=powerpc
184 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
185 REDEFINE =
186 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
187 $(REDEFINE) -Wa,-mregnames
188 LDFLAGS += -mcrt=$(CRT)
190 else
191 ifeq ($(OS), os3)
193 ##############################
194 # AmigaOS3
196 # Compiler/link/strip commands
197 ifneq ($(HOST), AmigaOS)
198 CC = m68k-amigaos-gcc
199 STRIP = m68k-amigaos-strip
200 OBJDUMP = m68k-amigaos-objdump
201 endif
203 # Compiler/Linker flags
204 CPU = -m68020-60 -msoft-float
205 CFLAGS += -noixemul -DNO_INLINE_STDARG
206 LDFLAGS += -noixemul
207 LDLIBS += -ldebug
209 else
210 ifeq ($(OS), mos)
212 ##############################
213 # MorphOS
215 # Compiler/link/strip commands
216 ifneq ($(HOST), MorphOS)
217 CC = ppc-morphos-gcc
218 STRIP = ppc-morphos-strip
219 OBJDUMP = ppc-morphos-objdump
220 endif
222 # Compiler/Linker flags
223 CPU = -mcpu=powerpc
224 CFLAGS += -noixemul
225 LDFLAGS += -noixemul
226 LDLIBS += -ldebug
228 else
229 ifeq ($(OS), aros-i386)
231 ##############################
232 # AROS (i386)
234 ifneq ($(HOST), AROS)
235 CC = i386-aros-gcc
236 STRIP = i386-aros-strip
237 OBJDUMP = i386-aros-objdump
238 endif
240 # Compiler/Linker flags
241 OPTFLAGS = -O2 -fomit-frame-pointer
242 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
243 LDLIBS += -larossupport -lrom
245 else
246 ifeq ($(OS), aros-ppc)
248 ##############################
249 # AROS (PPC)
251 ifneq ($(HOST), AROS)
252 CC = ppc-aros-gcc
253 STRIP = ppc-aros-strip
254 OBJDUMP = ppc-aros-objdump
255 endif
257 # Compiler/Linker flags
258 OPTFLAGS = -O2 -fomit-frame-pointer
259 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
260 LDLIBS += -larossupport -lrom
262 else
263 ifeq ($(OS), aros-x86_64)
265 ##############################
266 # AROS (x86_64)
268 ifneq ($(HOST), AROS)
269 CC = x86_64-aros-gcc
270 STRIP = x86_64-aros-strip
271 OBJDUMP = x86_64-aros-objdump
272 endif
274 # Compiler/Linker flags
275 OPTFLAGS = -O2 -fomit-frame-pointer
276 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
277 LDLIBS += -larossupport -lrom
279 endif
280 endif
281 endif
282 endif
283 endif
284 endif
286 ###########################################################################
287 # Here starts all stuff that is common for all target platforms and
288 # hosts.
290 OBJS += OpenURL.o \
291 SmartReadArgs.o \
292 debug.o
294 # main target
295 .PHONY: all
296 ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
297 # great, we have a dependecies file, let's make our target
298 all: $(BINDIR) $(OBJDIR) $(TARGET)
299 else
300 # no dependecies, create it and then call make again
301 all: depend
302 @make --no-print-directory all
303 endif
305 # make the object directories
306 $(OBJDIR):
307 @echo " MK $@"
308 @$(MKDIR) $(OBJDIR)
310 # make the object directories
311 $(BINDIR):
312 @echo " MK $@"
313 @$(MKDIR) $(BINDIR)
315 # for compiling single .c files
316 $(OBJDIR)/%.o: %.c
317 @echo " CC $<"
318 @$(CC) $(CFLAGS) -c $< -o $@
320 # for linking the target
321 $(TARGET): $(addprefix $(OBJDIR)/,$(OBJS))
322 @echo " LD $@.debug"
323 @$(CC) $(LDFLAGS) -o $@.debug $(addprefix $(OBJDIR)/,$(OBJS)) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
324 @echo " LD $@"
325 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
326 @$(CHMOD) $@
328 # for creating a .dump file
329 .PHONY: dump
330 dump:
331 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET).debug > $(TARGET).dump
333 # cleanup target
334 .PHONY: clean
335 clean:
336 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map $(addprefix $(OBJDIR)/,$(OBJS))
338 # clean all including .obj directory
339 .PHONY: cleanall
340 cleanall: clean
341 -$(RMDIR) $(OBJDIR)
343 # clean all stuff, including our autotools
344 .PHONY: distclean
345 distclean: cleanall
346 -$(RMDIR) $(BINDIR)
348 #install the newly built library to LIBS:
349 .PHONY: install
350 install: all
351 -$(CP) $(TARGET) LIBS:
353 ## DEPENDENCY GENERATION ##############
355 $(DEPFILE): ;
356 @echo "WARNING: $(DEPFILE) missing. Please run 'make depend'"
358 ## DEPENDENCY GENERATION ##############
360 .PHONY: depend
361 depend:
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
369 -include $(DEPFILE)