arch/cpu.resource: remove dead code
[AROS.git] / workbench / classes / zune / betterstring / mcp / Makefile
blobba79c41a0674e61bea6bb95f17a4b53c623017c7
1 #/***************************************************************************
3 # BetterString.mcc - A better String gadget MUI Custom Class
4 # Copyright (C) 1997-2000 Allan Odgaard
5 # Copyright (C) 2005-2009 by BetterString.mcc 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 # BetterString class Support Site: http://www.sf.net/projects/bstring-mcc/
19 # $Id$
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 HOST ?= $(shell uname)
42 ifeq ($(HOST), AmigaOS)
43 ifeq ($(shell uname -m), powerpc)
44 HOST = AmigaOS4
45 endif
46 ifeq ($(shell uname -m), ppc)
47 HOST = AmigaOS4
48 endif
49 endif
51 # if no host is identifed (no uname tool)
52 # we assume a AmigaOS build
53 ifeq ($(HOST),)
54 HOST = AmigaOS
55 endif
57 #############################################
58 # now we find out the target OS for
59 # which we are going to compile YAM in case
60 # the caller didn't yet define OS himself
61 ifndef (OS)
62 ifeq ($(HOST), AmigaOS4)
63 OS = os4
64 else
65 ifeq ($(HOST), AmigaOS)
66 OS = os3
67 else
68 ifeq ($(HOST), MorphOS)
69 OS = mos
70 else
71 ifeq ($(HOST), AROS)
72 # now we find out which CPU system aros will be used
73 ifeq ($(shell uname -m), powerpc)
74 OS = aros-ppc
75 endif
76 ifeq ($(shell uname -m), ppc)
77 OS = aros-ppc
78 endif
79 ifeq ($(shell uname -m), i386)
80 OS = aros-i386
81 endif
82 ifeq ($(shell uname -m), i686)
83 OS = aros-i686
84 endif
85 ifeq ($(shell uname -m), x86_64)
86 OS = aros-x86_64
87 endif
88 else
89 OS = os4
90 endif
91 endif
92 endif
93 endif
94 endif
96 #############################################
97 # define common commands we use in this
98 # makefile. Please note that each of them
99 # might be overridden on the commandline.
101 # common commands
102 FLEX = flex
103 FC = flexcat
104 EXPR = expr
105 DATE = date
106 RM = delete force
107 RMDIR = delete force all
108 MKDIR = makedir
109 CHMOD = protect FLAGS=rwed
110 SED = sed
111 CP = copy
112 CC = gcc
113 STRIP = strip
114 OBJDUMP = objdump
116 # path definitions
117 CDUP = /
118 CDTHIS=
120 # override some variables for non-native builds (cross-compiler)
121 ifneq ($(HOST), AmigaOS)
122 ifneq ($(HOST), AmigaOS4)
123 ifneq ($(HOST), MorphOS)
125 # when we end up here this is either a unix or Aros host
126 # so lets use unix kind of commands
127 RM = rm -f
128 RMDIR = rm -rf
129 MKDIR = mkdir -p
130 CHMOD = chmod 755
131 CP = cp -f
133 CDUP = ../
134 CDTHIS= ./
136 endif
137 endif
138 endif
140 ###########################################################################
141 # CPU and DEBUG can be defined outside, defaults to above
142 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
143 # PPC-603e version
145 # OPTFLAGS are disabled by DEBUG normally!
147 # ignored warnings are:
148 # none - because we want to compile with -Wall all the time
150 # Common Directories
151 PREFIX = $(CDTHIS)
152 OBJDIR = .obj_$(OS)
153 BINDIR = bin_$(OS)
154 VPATH = $(OBJDIR)
155 DEPFILE = Makefile.dep
156 DESTDIR = MUI:Libs/MUI
157 LOCALE = locale
159 # target definition
160 TARGET = $(BINDIR)/BetterString.mcp
161 TESTTARGET= $(BINDIR)/BetterString-Prefs
163 # Common compiler/linker flags
164 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
165 OPTFLAGS = -O3 -fomit-frame-pointer
166 DEBUG = -DDEBUG -O0
167 DEBUGSYM = -g -gstabs
168 CFLAGS = -I. -I../mcc -I../include $(CPU) $(WARN) $(OPTFLAGS) \
169 $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS) -c
170 LDFLAGS = $(CPU) $(DEBUGSYM)
171 LDLIBS =
173 ###########################################################################
174 # object files definition
177 LOBJS = library.o
179 COBJS = locale.o \
180 CreatePrefsGroup.o \
181 Dispatcher.o \
182 Debug.o \
183 icon.o
185 TOBJS = Preference.o
187 MCCOBJS = $(addprefix $(OBJDIR)/,$(LOBJS)) $(addprefix $(OBJDIR)/,$(COBJS))
188 TESTOBJS = $(addprefix $(OBJDIR)/,$(COBJS)) $(addprefix $(OBJDIR)/,$(TOBJS))
190 # available catalog translations
191 CATALOGS = $(patsubst %.po,%.catalog,$(wildcard $(LOCALE)/*.po))
193 # different options per target OS
194 ifeq ($(OS), os4)
196 ##############################
197 # AmigaOS4
199 # Compiler/link/strip commands
200 ifneq ($(HOST), AmigaOS4)
201 CC = ppc-amigaos-gcc
202 STRIP = ppc-amigaos-strip
203 OBJDUMP = ppc-amigaos-objdump
204 endif
206 # Compiler/Linker flags
207 CRT = newlib
208 CPU = -mcpu=powerpc
209 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
210 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
211 -DNO_PPCINLINE_STDARG -Wa,-mregnames
212 LDFLAGS += -mcrt=$(CRT)
214 # additional object files required
215 M68KSTUBS = $(OBJDIR)/mccclass_68k.o
217 else
218 ifeq ($(OS), os3)
220 ##############################
221 # AmigaOS3
223 # Compiler/link/strip commands
224 ifneq ($(HOST), AmigaOS)
225 CC = m68k-amigaos-gcc
226 STRIP = m68k-amigaos-strip
227 OBJDUMP = m68k-amigaos-objdump
228 endif
230 # Compiler/Linker flags
231 CPU = -m68020-60 -msoft-float
232 CFLAGS += -noixemul -DNO_INLINE_STDARG -D__amigaos3__
233 LDFLAGS += -noixemul
234 LDLIBS += -ldebug -lmui
236 # additional object files required
237 COBJS += vastubs.o
239 else
240 ifeq ($(OS), mos)
242 ##############################
243 # MorphOS
245 # Compiler/link/strip commands
246 ifneq ($(HOST), MorphOS)
247 CC = ppc-morphos-gcc
248 STRIP = ppc-morphos-strip
249 OBJDUMP = ppc-morphos-objdump
250 endif
252 # Compiler/Linker flags
253 CPU = -mcpu=powerpc
254 CFLAGS += -noixemul -DNO_PPCINLINE_STDARG
255 LDFLAGS += -noixemul
256 LDLIBS += -ldebug
258 else
259 ifeq ($(OS), aros-i386)
261 ##############################
262 # AROS (i386)
264 ifneq ($(HOST), AROS)
265 CC = i386-aros-gcc
266 STRIP = i386-aros-strip
267 OBJDUMP = i386-aros-objdump
268 endif
270 # Compiler/Linker flags
271 OPTFLAGS = -O2 -fomit-frame-pointer
272 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
273 LDLIBS += -larossupport -lrom -lmui
275 else
276 ifeq ($(OS), aros-ppc)
278 ##############################
279 # AROS (PPC)
281 ifneq ($(HOST), AROS)
282 CC = ppc-aros-gcc
283 STRIP = ppc-aros-strip
284 OBJDUMP = ppc-aros-objdump
285 endif
287 # Compiler/Linker flags
288 OPTFLAGS = -O2 -fomit-frame-pointer
289 CFLAGS += -Wno-pointer-sign
290 LDLIBS += -larossupport -lrom -lmui
292 else
293 ifeq ($(OS), aros-x86_64)
295 ##############################
296 # AROS (x86_64)
298 ifneq ($(HOST), AROS)
299 CC = x86_64-aros-gcc
300 STRIP = x86_64-aros-strip
301 OBJDUMP = x86_64-aros-objdump
302 endif
304 # Compiler/Linker flags
305 OPTFLAGS = -O2 -fomit-frame-pointer
306 CFLAGS += -Wno-pointer-sign
307 LDLIBS += -larossupport -lrom -lmui
309 endif
310 endif
311 endif
312 endif
313 endif
314 endif
316 # main target
317 .PHONY: all
318 ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
319 # great, we have a dependecies file, let's make our target
320 all: $(BINDIR) $(OBJDIR) $(M68KSTUBS) $(TARGET) $(TESTTARGET)
321 else
322 # no dependecies, create it and then call make again
323 all: depend
324 @make --no-print-directory all
325 endif
327 # for making a release we compile ALL target with no debug
328 release:
329 @echo " CC $<"
330 make OS=os4 clean
331 make OS=os4 DEBUG=
332 @echo " CC $<"
333 make OS=os3 clean
334 make OS=os3 DEBUG=
335 @echo " CC $<"
336 make OS=mos clean
337 make OS=mos DEBUG=
338 @echo " CC $<"
339 make OS=aros-i386 clean
340 make OS=aros-i386 DEBUG=
341 @echo " CC $<"
342 make OS=aros-ppc clean
343 make OS=aros-ppc DEBUG=
344 @echo " CC $<"
345 make OS=aros-x86_64 clean
346 make OS=aros-x86_64 DEBUG=
348 # make the object directories
349 $(OBJDIR):
350 @echo " MK $@"
351 @$(MKDIR) $(OBJDIR)
353 # make the binary directories
354 $(BINDIR):
355 @echo " MK $@"
356 @$(MKDIR) $(BINDIR)
358 # for compiling single .c files
359 $(OBJDIR)/%.o: %.c
360 @echo " CC $<"
361 @$(CC) $(CFLAGS) $< -o $@
363 $(OBJDIR)/mccclass_68k.o: ../include/mccclass_68k.c
364 @echo " CC $<"
365 @$(CC) $(CFLAGS) $< -o $@
367 # for linking the target
368 $(TARGET): $(M68KSTUBS) $(MCCOBJS)
369 @echo " LD $@.debug"
370 @$(CC) -nostartfiles $(LDFLAGS) -o $@.debug $(MCCOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
371 @echo " LD $@"
372 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
374 # for linking the target
375 $(TESTTARGET): $(TESTOBJS)
376 @echo " LD $@.debug"
377 @$(CC) $(LDFLAGS) -o $@.debug $(TESTOBJS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
378 @echo " LD $@"
379 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
381 locale.h: locale.c
382 locale.c: $(LOCALE)/BetterString_mcp.pot C_h.sd C_c.sd
383 @echo " MK $@"
384 @$(FC) $(LOCALE)/BetterString_mcp.pot locale.h=C_h.sd locale.c=C_c.sd
386 ## CATALOG GENERATION #################
388 $(LOCALE)/%.catalog: $(LOCALE)/%.po
389 @echo " MK $@"
390 @$(FC) POFILE $< CATALOG $@
392 .IGNORE: $(CATALOGS)
394 catalogs: $(CATALOGS)
396 .PHONY: dump
397 dump:
398 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET) > $(TARGET).dump
400 .PHONY: clean
401 clean:
402 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map
403 -$(RM) $(PREFTARGET) $(PREFTARGET).debug $(PREFTARGET).map
404 -$(RM) $(MCCOBJS) $(TESTOBJS) $(M68KSTUBS)
405 -$(RM) $(LOCALE)/*.catalog
407 .PHONY: distclean
408 distclean: clean
409 -$(RM) locale.?
410 -$(RMDIR) $(OBJDIR)
411 -$(RMDIR) $(BINDIR)
413 # install
414 .PHONY: install
415 install: all
416 @echo " IN $(TARGET)"
417 @$(CP) $(TARGET) $(DESTDIR)
419 .PHONY: help
420 help:
421 @echo "Cleaning targets:"
422 @echo " clean - Cleanup working directory for clean compile"
423 @echo " distclean - Also cleanup autogenerated files"
424 @echo ""
425 @echo "Other generic targets:"
426 @echo " all - Build $(TARGET)"
427 @echo " catalogs - Build all available catalogs"
428 @echo ""
429 @echo "Install targets:"
430 @echo " install - Install $(TARGET) into $(DESTDIR)"
431 @echo ""
432 @echo "Parameters:"
433 @echo " make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
434 @echo " make DEBUG= : build $(TARGET) without debugging information"
435 @echo ""
437 ## DEPENDENCY GENERATION ##############
439 .PHONY: depend
440 depend:
441 @echo " MK $(DEPFILE)"
442 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE)
443 @$(CC) -MM -MG $(CFLAGS) $(wildcard *.c) >>$(DEPFILE)
444 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE)
445 @$(SED) -i 's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE)
447 # include dependencies file
448 -include $(DEPFILE)