Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / codesetslib / src / Makefile
blobba456af587e13246d53dd51af967e937677a294c
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 # now we find out which CPU system aros will be used
77 ifeq ($(shell uname -m), powerpc)
78 OS = aros-ppc
79 endif
80 ifeq ($(shell uname -m), ppc)
81 OS = aros-ppc
82 endif
83 ifeq ($(shell uname -m), i386)
84 OS = aros-i386
85 endif
86 ifeq ($(shell uname -m), i686)
87 OS = aros-i686
88 endif
89 ifeq ($(shell uname -m), x86_64)
90 OS = aros-x86_64
91 endif
92 else
93 OS = os4
94 endif
95 endif
96 endif
97 endif
98 endif
100 #############################################
101 # define common commands we use in this
102 # makefile. Please note that each of them
103 # might be overridden on the commandline.
105 # common commands
106 FLEX = flex
107 FC = flexcat
108 EXPR = expr
109 DATE = date
110 RM = delete force
111 RMDIR = delete force all
112 MKDIR = makedir
113 CHMOD = protect FLAGS=rwed
114 CP = copy
115 CC = gcc
116 STRIP = strip
117 OBJDUMP = objdump
119 # path definitions
120 CDUP = /
121 CDTHIS=
123 # override some variables for non-native builds (cross-compiler)
124 ifneq ($(HOST), AmigaOS)
125 ifneq ($(HOST), AmigaOS4)
126 ifneq ($(HOST), MorphOS)
128 # when we end up here this is either a unix or Aros host
129 # so lets use unix kind of commands
130 RM = rm -f
131 RMDIR = rm -rf
132 MKDIR = mkdir -p
133 CHMOD = chmod 755
134 CP = cp -f
136 CDUP = ../
137 CDTHIS= ./
139 endif
140 endif
141 endif
143 ###########################################################################
144 # CPU and DEBUG can be defined outside, defaults to above
145 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
146 # PPC-603e version
148 # OPTFLAGS are disabled by DEBUG normally!
150 # ignored warnings are:
151 # none - because we want to compile with -Wall all the time
153 # Common Directories
154 PREFIX = $(CDTHIS)
155 OBJDIR = .obj_$(OS)
156 BINDIR = bin_$(OS)
157 VPATH = $(OBJDIR)
159 # target definition
160 TARGET = $(BINDIR)/codesets.library
162 # Common compiler/linker flags
163 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
164 OPTFLAGS = -O3 -fomit-frame-pointer -funroll-loops
165 DEBUG = -DDEBUG -O0
166 DEBUGSYM = -gstabs
167 CFLAGS = -I. -I../include $(CPU) $(WARN) $(OPTFLAGS) $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS)
168 LDFLAGS = $(CPU) $(DEBUGSYM) -nostartfiles
169 LDLIBS =
171 # different options per target OS
172 ifeq ($(OS), os4)
174 ##############################
175 # AmigaOS4
177 # Compiler/link/strip commands
178 ifneq ($(HOST), AmigaOS4)
179 CC = ppc-amigaos-gcc
180 STRIP = ppc-amigaos-strip
181 OBJDUMP = ppc-amigaos-objdump
182 endif
184 # Compiler/Linker flags
185 CRT = newlib
186 CPU = -mcpu=powerpc
187 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
188 REDEFINE =
189 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
190 $(REDEFINE) -Wa,-mregnames
191 LDFLAGS += -mcrt=$(CRT)
193 # additional object files required
194 OBJS = stubs-amigaos4.o
195 M68KSTUBS = $(OBJDIR)/codesets_68k.o
197 else
198 ifeq ($(OS), os3)
200 ##############################
201 # AmigaOS3
203 # Compiler/link/strip commands
204 ifneq ($(HOST), AmigaOS)
205 CC = m68k-amigaos-gcc
206 STRIP = m68k-amigaos-strip
207 OBJDUMP = m68k-amigaos-objdump
208 endif
210 # Compiler/Linker flags
211 CPU = -m68020-60 -msoft-float
212 CFLAGS += -noixemul
213 LDFLAGS += -noixemul
214 LDLIBS += -ldebug
216 else
217 ifeq ($(OS), mos)
219 ##############################
220 # MorphOS
222 # Compiler/link/strip commands
223 ifneq ($(HOST), MorphOS)
224 CC = ppc-morphos-gcc
225 STRIP = ppc-morphos-strip
226 OBJDUMP = ppc-morphos-objdump
227 endif
229 # Compiler/Linker flags
230 CPU = -mcpu=powerpc
231 CFLAGS += -noixemul
232 LDFLAGS += -noixemul
233 LDLIBS += -ldebug
235 OBJS = stubs-morphos.o
237 else
238 ifeq ($(OS), aros-i386)
240 ##############################
241 # AROS (i386)
243 ifneq ($(HOST), AROS)
244 CC = i386-aros-gcc
245 STRIP = i386-aros-strip
246 OBJDUMP = i386-aros-objdump
247 endif
249 # Compiler/Linker flags
250 CFLAGS += -Wno-pointer-sign
251 LDLIBS += -lrom
253 else
254 ifeq ($(OS), aros-ppc)
256 ##############################
257 # AROS (PPC)
259 ifneq ($(HOST), AROS)
260 CC = ppc-aros-gcc
261 STRIP = ppc-aros-strip
262 OBJDUMP = ppc-aros-objdump
263 endif
265 # Compiler/Linker flags
266 CFLAGS += -Wno-pointer-sign
267 LDLIBS += -lrom
269 else
270 ifeq ($(OS), aros-x86_64)
272 ##############################
273 # AROS (x86_64)
275 ifneq ($(HOST), AROS)
276 CC = x86_64-aros-gcc
277 STRIP = x86_64-aros-strip
278 OBJDUMP = x86_64-aros-objdump
279 endif
281 # Compiler/Linker flags
282 CFLAGS += -Wno-pointer-sign
283 LDLIBS += -lrom
285 endif
286 endif
287 endif
288 endif
289 endif
290 endif
292 ###########################################################################
293 # Here starts all stuff that is common for all target platforms and
294 # hosts.
296 OBJS += libinit.o \
297 init.o \
298 utils.o \
299 base64.o \
300 convertUTF.o \
301 codesets.o \
302 codepages.o \
303 debug.o
305 # main target
306 .PHONY: all
307 all: $(BINDIR) $(OBJDIR) $(TARGET)
309 # make the object directories
310 $(OBJDIR):
311 @echo " MK $@"
312 @$(MKDIR) $(OBJDIR)
314 # make the object directories
315 $(BINDIR):
316 @echo " MK $@"
317 @$(MKDIR) $(BINDIR)
319 # for compiling single .c files
320 %.o: %.c
321 @echo " CC $<"
322 @$(CC) $(CFLAGS) -c $< -o $(OBJDIR)/$@
324 # for linking the target
325 $(TARGET): $(M68KSTUBS) $(OBJS)
326 @echo " LD $@.debug"
327 @$(CC) $(LDFLAGS) -o $@.debug $(addprefix $(OBJDIR)/,$(OBJS)) $(M68KSTUBS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
328 @echo " LD $@"
329 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
330 @$(CHMOD) $@
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 #install the newly built library to LIBS:
353 .PHONY: install
354 install: all
355 -$(CP) $(TARGET) LIBS:
357 ## SPECIAL COMPILE RULES ##############
359 $(OBJDIR)/codesets_68k.o: ../include/codesets_68k.c
360 @echo " CC $<"
361 @$(CC) $(CFLAGS) -c $< -o $@
363 ## DEPENDENCY GENERATION ##############
365 Makefile.dep: ;
366 @echo "WARNING: Makefile.dep missing. Please run 'make depend'"
368 .PHONY: depend
369 depend:
370 @echo " MK Makefile.dep"
371 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >Makefile.dep
372 @$(CC) -MM $(CFLAGS) $(patsubst %.o,%.c, $(OBJS)) >>Makefile.dep
373 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>Makefile.dep
375 ## DEPENDENCY INCLUDE #################
377 -include Makefile.dep