Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / codesetslib / libcodesets / Makefile
blob1184f50eaa2e9b944b92f9867713270ba0ea20ca
1 #/***************************************************************************
3 # codesets.library - Amiga shared library for handling different codesets
4 # Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
5 # Copyright (C) 2005-2009 by codesets.library Open Source Team
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # codesets.library project: http://sourceforge.net/projects/codesetslib/
19 # Most of the code included in this file was relicensed from GPL to LGPL
20 # from the source code of SimpleMail (http://www.sf.net/projects/simplemail)
21 # with full permissions by its authors.
23 # $Id: codesets.c 92 2007-12-18 11:37:55Z damato $
25 #***************************************************************************/
27 ###########################################################################
28 # This makefile is a very generic one. It tries to identify both, the host
29 # and the target operating system for which YAM should be compiled.
30 # However, this auto-detection can be easily overridden by directly
31 # specifying an option on the commandline while calling 'make'.
33 # Example:
35 # # to explicitly compile for AmigaOS3
36 # > make OS=os3
38 # # to compile for AmigaOS4 but without debugging
39 # > make OS=os4 DEBUG=
42 #############################################
43 # find out the HOST operating system
44 # on which this makefile is run
45 HOST ?= $(shell uname)
46 ifeq ($(HOST), AmigaOS)
47 ifeq ($(shell uname -m), powerpc)
48 HOST = AmigaOS4
49 endif
50 ifeq ($(shell uname -m), ppc)
51 HOST = AmigaOS4
52 endif
53 endif
55 # if no host is identifed (no uname tool)
56 # we assume a AmigaOS build
57 ifeq ($(HOST),)
58 HOST = AmigaOS
59 endif
61 #############################################
62 # now we find out the target OS for
63 # which we are going to compile YAM in case
64 # the caller didn't yet define OS himself
65 ifndef (OS)
66 ifeq ($(HOST), AmigaOS4)
67 OS = os4
68 else
69 ifeq ($(HOST), AmigaOS)
70 OS = os3
71 else
72 ifeq ($(HOST), MorphOS)
73 OS = mos
74 else
75 ifeq ($(HOST), Aros)
76 OS = aros
77 else
78 OS = os4
79 endif
80 endif
81 endif
82 endif
83 endif
85 #############################################
86 # define common commands we use in this
87 # makefile. Please note that each of them
88 # might be overridden on the commandline.
90 # common commands
91 FLEX = flex
92 FC = flexcat
93 EXPR = expr
94 DATE = date
95 RM = delete force
96 RMDIR = delete force all
97 MKDIR = makedir
98 CHMOD = protect FLAGS=rwed
99 CP = copy
100 CC = gcc
101 STRIP = strip
102 OBJDUMP = objdump
103 AR = ar
104 RANLIB = ranlib
106 # path definitions
107 CDUP = /
108 CDTHIS=
110 # override some variables for non-native builds (cross-compiler)
111 ifneq ($(HOST), AmigaOS)
112 ifneq ($(HOST), AmigaOS4)
113 ifneq ($(HOST), MorphOS)
115 # when we end up here this is either a unix or Aros host
116 # so lets use unix kind of commands
117 RM = rm -f
118 RMDIR = rm -rf
119 MKDIR = mkdir -p
120 CHMOD = chmod 755
121 CP = cp -f
123 CDUP = ../
124 CDTHIS= ./
126 endif
127 endif
128 endif
130 ###########################################################################
131 # CPU and DEBUG can be defined outside, defaults to above
132 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
133 # PPC-603e version
135 # OPTFLAGS are disabled by DEBUG normally!
137 # ignored warnings are:
138 # none - because we want to compile with -Wall all the time
140 # Common Directories
141 PREFIX = $(CDTHIS)
142 OBJDIR = .obj_$(OS)
143 BINDIR = bin_$(OS)
144 VPATH = $(OBJDIR)
146 # target definition
147 TARGET = $(BINDIR)/libcodesets.a
149 # Common compiler/linker flags
150 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
151 OPTFLAGS = -O3 -fomit-frame-pointer -funroll-loops
152 DEBUG = -DDEBUG -O0
153 DEBUGSYM = -gstabs
154 CFLAGS = -I. -I../include $(CPU) $(WARN) $(OPTFLAGS) $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS)
155 LDFLAGS = $(CPU) $(DEBUGSYM) -nostartfiles
156 LDLIBS =
158 # different options per target OS
159 ifeq ($(OS), os4)
161 ##############################
162 # AmigaOS4
164 # Compiler/link/strip commands
165 ifneq ($(HOST), AmigaOS4)
166 CC = ppc-amigaos-gcc
167 STRIP = ppc-amigaos-strip
168 OBJDUMP = ppc-amigaos-objdump
169 AR = ppc-amigaos-ar
170 RANLIB = ppc-amigaos-ranlib
171 endif
173 # Compiler/Linker flags
174 CRT = newlib
175 CPU = -mcpu=powerpc
176 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
177 REDEFINE =
178 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
179 $(REDEFINE) -Wa,-mregnames
180 LDFLAGS += -mcrt=$(CRT)
182 else
183 ifeq ($(OS), os3)
185 ##############################
186 # AmigaOS3
188 # Compiler/link/strip commands
189 ifneq ($(HOST), AmigaOS)
190 CC = m68k-amigaos-gcc
191 STRIP = m68k-amigaos-strip
192 OBJDUMP = m68k-amigaos-objdump
193 AR = m68k-amigaos-ar
194 RANLIB = m68k-amigaos-ranlib
195 endif
197 # Compiler/Linker flags
198 CPU = -m68020-60 -msoft-float
199 CFLAGS += -noixemul
200 LDFLAGS += -noixemul
201 LDLIBS += -ldebug
203 else
204 ifeq ($(OS), mos)
206 ##############################
207 # MorphOS
209 # Compiler/link/strip commands
210 ifneq ($(HOST), MorphOS)
211 CC = ppc-morphos-gcc
212 STRIP = ppc-morphos-strip
213 OBJDUMP = ppc-morphos-objdump
214 AR = ppc-morphos-ar
215 RANLIB = ppc-morphos-ranlib
216 endif
218 # Compiler/Linker flags
219 CPU = -mcpu=powerpc
220 CFLAGS += -noixemul
221 LDFLAGS += -noixemul
222 LDLIBS += -ldebug
224 else
225 ifeq ($(OS), aros)
227 ##############################
228 # AROS
230 # Compiler/link/strip commands
231 ifeq ($(TARGET_CPU),)
232 TARGET_CPU = i386
233 endif
234 ifneq ($(HOST), aros)
235 CC = $(TARGET_CPU)-aros-gcc
236 STRIP = $(TARGET_CPU)-aros-strip
237 OBJDUMP = $(TARGET_CPU)-aros-objdump
238 AR = $(TARGET_CPU)-aros-ar
239 RANLIB = $(TARGET_CPU)-aros-ranlib
240 endif
242 OBJS = autoinit-aros.o
244 # Compiler/Linker flags
245 LDLIBS += -lrom
247 endif
248 endif
249 endif
250 endif
252 ###########################################################################
253 # Here starts all stuff that is common for all target platforms and
254 # hosts.
256 # TODO: add stubs
257 # OBJS +=
259 # main target
260 .PHONY: all
261 all: $(BINDIR) $(OBJDIR) $(TARGET)
263 # make the object directories
264 $(OBJDIR):
265 @echo " MK $@"
266 @$(MKDIR) $(OBJDIR)
268 # make the object directories
269 $(BINDIR):
270 @echo " MK $@"
271 @$(MKDIR) $(BINDIR)
273 # for compiling single .c files
274 %.o: %.c
275 @echo " CC $<"
276 @$(CC) $(CFLAGS) -c $< -o $(OBJDIR)/$@
278 # for linking the target
279 $(TARGET): $(OBJS)
280 @echo " AR $@"
281 @$(AR) -r $@ $(addprefix $(OBJDIR)/,$(OBJS))
282 @$(RANLIB) $@
284 # for creating a .dump file
285 .PHONY: dump
286 dump:
287 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET).debug > $(TARGET).dump
289 # cleanup target
290 .PHONY: clean
291 clean:
292 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map $(addprefix $(OBJDIR)/,$(OBJS)) $(M68KSTUBS)
294 # clean all including .obj directory
295 .PHONY: cleanall
296 cleanall: clean
297 -$(RMDIR) $(OBJDIR)
299 # clean all stuff, including our autotools
300 .PHONY: distclean
301 distclean: cleanall
302 -$(RMDIR) $(BINDIR)
304 ## DEPENDENCY GENERATION ##############
306 Makefile.dep: ;
307 @echo "WARNING: Makefile.dep missing. Please run 'make depend'"
309 .PHONY: depend
310 depend:
311 @echo " MK Makefile.dep"
312 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >Makefile.dep
313 @$(CC) -MM $(CFLAGS) $(patsubst %.o,%.c, $(OBJS)) >>Makefile.dep
314 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>Makefile.dep
316 ## DEPENDENCY INCLUDE #################
318 -include Makefile.dep