Stunt: get codesetslib from its own Sourceforge repository.
[cake.git] / workbench / libs / codesetslib / src / Makefile
blob63910c5a9854976cc69903485f9ac273a7837bde
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-2007 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 # $Id: makefile.os4 62 2007-01-23 08:55:18Z damato $
21 #***************************************************************************/
23 ###########################################################################
24 # This makefile is a very generic one. It tries to identify both, the host
25 # and the target operating system for which YAM should be compiled.
26 # However, this auto-detection can be easily overridden by directly
27 # specifying an option on the commandline while calling 'make'.
29 # Example:
31 # # to explicitly compile for AmigaOS3
32 # > make OS=os3
34 # # to compile for AmigaOS4 but with debugging
35 # > make OS=os4 DEBUG=
38 #############################################
39 # find out the HOST operating system
40 # on which this makefile is run
41 ifndef (HOST)
42 HOST = $(shell uname)
43 ifeq ($(HOST), AmigaOS)
44 ifeq ($(shell uname -m), powerpc)
45 HOST = AmigaOS4
46 endif
47 ifeq ($(shell uname -m), ppc)
48 HOST = AmigaOS4
49 endif
50 endif
51 endif
53 #############################################
54 # now we find out the target OS for
55 # which we are going to compile YAM in case
56 # the caller didn't yet define OS himself
57 ifndef (OS)
58 ifeq ($(HOST), AmigaOS4)
59 OS = os4
60 else
61 ifeq ($(HOST), AmigaOS)
62 OS = os3
63 else
64 ifeq ($(HOST), MorphOS)
65 OS = mos
66 else
67 ifeq ($(HOST), Aros)
68 OS = aros
69 else
70 OS = os4
71 endif
72 endif
73 endif
74 endif
75 endif
77 #############################################
78 # define common commands we use in this
79 # makefile. Please note that each of them
80 # might be overridden on the commandline.
82 # common commands
83 FLEX = flex
84 FC = flexcat
85 EXPR = expr
86 CHMOD = chmod
87 SED = sed
88 DATE = date
89 RM = rm -f
90 RMDIR = rm -rf
91 MKDIR = mkdir
93 # override commands for native builds
94 ifeq ($(HOST), AmigaOS4)
95 # AmigaOS4 host
96 RM = delete force
97 RMDIR = delete force all
98 MKDIR = makedir
99 DATE = gdate
100 else
101 ifeq ($(HOST), AmigaOS)
102 # AmigaOS3 host
103 RM = delete force
104 RMDIR = delete force all
105 MKDIR = makedir
106 else
107 ifeq ($(HOST), MorphOS)
108 # MorphOS host
109 RM = delete force
110 RMDIR = delete force all
111 MKDIR = makedir
112 endif
113 endif
114 endif
116 ###########################################################################
117 # CPU and DEBUG can be defined outside, defaults to above
118 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
119 # PPC-603e version
121 # OPTFLAGS are disabled by DEBUG normally!
123 # ignored warnings are:
124 # none - because we want to compile with -Wall all the time
126 # Common Directories
127 PREFIX = .
128 OBJDIR = .obj_$(OS)
129 BINDIR = bin_$(OS)
131 # target definition
132 TARGET = $(BINDIR)/codesets.library
134 # Common compiler/linker flags
135 WARN = -W -Wall -Wwrite-strings
136 OPTFLAGS = -O3 -fomit-frame-pointer -funroll-loops
137 DEBUG = -DDEBUG #-O0
138 DEBUGSYM = -gstabs
139 CFLAGS = -I. -I../include $(CPU) $(WARN) $(OPTFLAGS) \
140 $(DEBUG) $(DEBUGSYM) -c
141 LDFLAGS = $(CPU) $(DEBUGSYM) -nostartfiles
142 LDLIBS =
144 # different options per target OS
145 ifeq ($(OS), os4)
147 ##############################
148 # AmigaOS4
150 # Compiler/link/strip commands
151 CC = ppc-amigaos-gcc
152 STRIP = ppc-amigaos-strip
153 OBJDUMP = ppc-amigaos-objdump
155 # Compiler/Linker flags
156 CRT = newlib
157 CPU = -mcpu=powerpc
158 REDEFINE = -DCoerceMethod=ICoerceMethod -DDoMethod=IDoMethod \
159 -DDoSuperMethod=IDoSuperMethod -DDoSuperMethodA=IDoSuperMethodA
160 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
161 $(REDEFINE) -Wa,-mregnames
162 LDFLAGS += -mcrt=$(CRT)
164 # additional object files required
165 M68KSTUBS = $(OBJDIR)/codesets_68k.o
167 else
168 ifeq ($(OS), os3)
170 ##############################
171 # AmigaOS3
173 # Compiler/link/strip commands
174 CC = m68k-amigaos-gcc
175 STRIP = m68k-amigaos-strip
176 OBJDUMP = m68k-amigaos-objdump
178 # Compiler/Linker flags
179 CPU = -m68020-60 -msoft-float
180 CFLAGS += -noixemul
181 LDFLAGS += -noixemul
182 LDLIBS += -ldebug
184 else
185 ifeq ($(OS), mos)
187 ##############################
188 # MorphOS
190 # Compiler/link/strip commands
191 CC = ppc-morphos-gcc
192 STRIP = ppc-morphos-strip
193 OBJDUMP = ppc-morphos-objdump
195 # Compiler/Linker flags
196 CPU = -mcpu=powerpc
197 CFLAGS += -noixemul
198 LDFLAGS += -noixemul
199 LDLIBS += -ldebug
201 else
202 ifeq ($(OS), aros)
204 ##############################
205 # AROS
207 # Compiler/link/strip commands
208 CC = i686-aros-gcc
209 STRIP = i686-aros-strip
210 OBJDUMP = i686-aros-objdump
212 # Compiler/Linker flags
213 CPU =
215 endif
216 endif
217 endif
218 endif
220 ###########################################################################
221 # Here starts all stuff that is common for all target platforms and
222 # hosts.
224 OBJS = $(OBJDIR)/libinit.o \
225 $(OBJDIR)/init.o \
226 $(OBJDIR)/utils.o \
227 $(OBJDIR)/base64.o \
228 $(OBJDIR)/convertUTF.o \
229 $(OBJDIR)/codesets.o \
230 $(OBJDIR)/debug.o
233 all: $(BINDIR) $(OBJDIR) $(TARGET)
235 # make the object directories
236 $(OBJDIR):
237 @printf '\033[33mGenerating $@ directory\033[0m\n'
238 @$(MKDIR) $(OBJDIR)
240 # make the binary directories
241 $(BINDIR):
242 @printf '\033[33mGenerating $@ directory\033[0m\n'
243 @$(MKDIR) $(BINDIR)
247 $(OBJDIR)/%.o: %.c
248 @printf '\033[32mCompiling $<\033[0m\n'
249 @$(CC) $(CFLAGS) $< -o $@
251 $(OBJDIR)/codesets_68k.o: ../include/codesets_68k.c
252 @printf '\033[32mCompiling $<\033[0m\n'
253 @$(CC) $(CFLAGS) $< -o $@
257 $(TARGET): $(M68KSTUBS) $(OBJS)
258 @printf '\033[32mLinking \033[1m$@\033[0m\n'
259 @$(CC) $(LDFLAGS) -o $@.debug $(OBJS) $(M68KSTUBS) $(LDLIBS) -Wl,-Map,$@.map
260 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
264 .PHONY: clean
265 clean:
266 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map $(OBJS) $(M68KSTUBS)
268 .PHONY: distclean
269 distclean: clean
270 -$(RMDIR) $(OBJDIR)
271 -$(RMDIR) $(BINDIR)
275 $(OBJDIR)/libinit.o: libinit.c lib.h version.h base.h macros.h lib_protos.h
276 $(OBJDIR)/init.o: init.c lib.h base.h macros.h lib_protos.h
277 $(OBJDIR)/utils.o: utils.c lib.h base.h macros.h lib_protos.h
278 $(OBJDIR)/base64.o: base64.c lib.h base.h macros.h lib_protos.h
279 $(OBJDIR)/convertUTF.o: convertUTF.c lib.h convertUTF.h base.h macros.h lib_protos.h
280 $(OBJDIR)/codesets.o: codesets.c lib.h codesets_table.h convertUTF.h base.h macros.h lib_protos.h
281 $(OBJDIR)/debug.o: debug.c lib.h version.h