revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / zune / nlist / nfloattext_mcc / Makefile
blobc60efd28b113ac9640cec0ad5d0f96661bcb728b
1 #/***************************************************************************
3 # NFloattext.mcc - New Floattext MUI Custom Class
4 # Registered MUI class, Serial Number: 1d51 (0x9d5100a1 to 0x9d5100aF)
6 # Copyright (C) 1996-2001 by Gilles Masson
7 # Copyright (C) 2001-2014 NList Open Source Team
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # NList classes Support Site: http://www.sf.net/projects/nlist-classes
21 # $Id$
23 #***************************************************************************/
25 ###########################################################################
26 # This makefile is a very generic one. It tries to identify both, the host
27 # and the target operating system for which YAM should be compiled.
28 # However, this auto-detection can be easily overridden by directly
29 # specifying an option on the commandline while calling 'make'.
31 # Example:
33 # # to explicitly compile for AmigaOS3
34 # > make OS=os3
36 # # to compile for AmigaOS4 but with debugging
37 # > make OS=os4 DEBUG=
40 #############################################
41 # find out the HOST operating system
42 # on which this makefile is run
43 HOST ?= $(shell uname)
44 ifeq ($(HOST), AmigaOS)
45 ifeq ($(shell uname -m), powerpc)
46 HOST = AmigaOS4
47 endif
48 ifeq ($(shell uname -m), ppc)
49 HOST = AmigaOS4
50 endif
51 endif
53 # if no host is identifed (no uname tool)
54 # we assume a AmigaOS build
55 ifeq ($(HOST),)
56 HOST = AmigaOS
57 endif
59 #############################################
60 # now we find out the target OS for
61 # which we are going to compile YAM in case
62 # the caller didn't yet define OS himself
63 ifndef (OS)
64 ifeq ($(HOST), AmigaOS4)
65 OS = os4
66 else
67 ifeq ($(HOST), AmigaOS)
68 OS = os3
69 else
70 ifeq ($(HOST), MorphOS)
71 OS = mos
72 else
73 ifeq ($(HOST), AROS)
74 # now we find out which CPU system aros will be used
75 ifeq ($(shell uname -m), powerpc)
76 OS = aros-ppc
77 endif
78 ifeq ($(shell uname -m), ppc)
79 OS = aros-ppc
80 endif
81 ifeq ($(shell uname -m), i386)
82 OS = aros-i386
83 endif
84 ifeq ($(shell uname -m), i686)
85 OS = aros-i686
86 endif
87 ifeq ($(shell uname -m), x86_64)
88 OS = aros-x86_64
89 endif
90 else
91 OS = os4
92 endif
93 endif
94 endif
95 endif
96 endif
98 #############################################
99 # define common commands we use in this
100 # makefile. Please note that each of them
101 # might be overridden on the commandline.
103 # common commands
104 FLEX = flex
105 FC = flexcat
106 EXPR = expr
107 DATE = date
108 RM = delete force
109 RMDIR = delete force all
110 MKDIR = makedir
111 CHMOD = protect FLAGS=rwed
112 SED = sed
113 CP = copy
114 CC = gcc
115 STRIP = strip
116 OBJDUMP = objdump
118 # path definitions
119 CDUP = /
120 CDTHIS=
122 # override some variables for non-native builds (cross-compiler)
123 ifneq ($(HOST), AmigaOS)
124 ifneq ($(HOST), AmigaOS4)
125 ifneq ($(HOST), MorphOS)
127 # when we end up here this is either a unix or Aros host
128 # so lets use unix kind of commands
129 RM = rm -f
130 RMDIR = rm -rf
131 MKDIR = mkdir -p
132 CHMOD = chmod 755
133 CP = cp -f
135 CDUP = ../
136 CDTHIS= ./
138 endif
139 endif
140 endif
142 ###########################################################################
143 # CPU and DEBUG can be defined outside, defaults to above
144 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
145 # PPC-603e version
147 # OPTFLAGS are disabled by DEBUG normally!
149 # ignored warnings are:
150 # none - because we want to compile with -Wall all the time
152 # Common Directories
153 PREFIX = $(CDTHIS)
154 OBJDIR = .obj_$(OS)
155 BINDIR = bin_$(OS)
156 VPATH = $(OBJDIR)
157 DEPFILE = Makefile.dep
158 DESTDIR = MUI:Libs/MUI
160 # target definition
161 TARGET = $(BINDIR)/NFloattext.mcc
162 TESTTARGET= $(BINDIR)/NFloattext-Test
164 # Common compiler/linker flags
165 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
166 OPTFLAGS = -O3 -fomit-frame-pointer
167 DEBUG = -DDEBUG -fno-omit-frame-pointer -O0
168 DEBUGSYM = -g -gstabs
169 CFLAGS = -I. -I../nlistviews_mcp -I../include $(CPU) $(WARN) $(OPTFLAGS) \
170 $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS) -c
171 LDFLAGS = $(CPU) $(DEBUGSYM)
172 LDLIBS =
174 ###########################################################################
175 # object files definition
178 LOBJS = library.o
180 COBJS = NFloattext.o \
181 Debug.o
183 TOBJS = #NFloattext-Test.o
185 MCCOBJS = $(addprefix $(OBJDIR)/,$(LOBJS)) $(addprefix $(OBJDIR)/,$(COBJS))
186 TESTOBJS = $(addprefix $(OBJDIR)/,$(COBJS)) $(addprefix $(OBJDIR)/,$(TOBJS))
188 # different options per target OS
189 ifeq ($(OS), os4)
191 ##############################
192 # AmigaOS4
194 # Compiler/link/strip commands
195 ifneq ($(HOST), AmigaOS4)
196 CC = ppc-amigaos-gcc
197 STRIP = ppc-amigaos-strip
198 OBJDUMP = ppc-amigaos-objdump
199 endif
201 # Compiler/Linker flags
202 CRT = newlib
203 CPU = -mcpu=powerpc
204 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
205 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
206 -DNO_PPCINLINE_STDARG -Wa,-mregnames
207 LDFLAGS += -mcrt=$(CRT)
209 # additional object files required
210 M68KSTUBS = $(OBJDIR)/mccclass_68k.o
212 else
213 ifeq ($(OS), os3)
215 ##############################
216 # AmigaOS3
218 # Compiler/link/strip commands
219 ifneq ($(HOST), AmigaOS)
220 CC = m68k-amigaos-gcc
221 STRIP = m68k-amigaos-strip
222 OBJDUMP = m68k-amigaos-objdump
223 endif
225 # Compiler/Linker flags
226 CPU = -m68020-60 -msoft-float
227 CFLAGS += -noixemul -DNO_INLINE_STDARG -D__amigaos3__
228 LDFLAGS += -noixemul
229 LDLIBS += -ldebug -lmui
231 else
232 ifeq ($(OS), mos)
234 ##############################
235 # MorphOS
237 # Compiler/link/strip commands
238 ifneq ($(HOST), MorphOS)
239 CC = ppc-morphos-gcc
240 STRIP = ppc-morphos-strip
241 OBJDUMP = ppc-morphos-objdump
242 endif
244 # Compiler/Linker flags
245 CPU = -mcpu=powerpc
246 CFLAGS += -noixemul -DNO_PPCINLINE_STDARG
247 LDFLAGS += -noixemul
248 LDLIBS += -ldebug
250 else
251 ifeq ($(OS), aros-i386)
253 ##############################
254 # AROS (i386)
256 ifneq ($(HOST), AROS)
257 CC = i386-aros-gcc
258 STRIP = i386-aros-strip
259 OBJDUMP = i386-aros-objdump
260 endif
262 # Compiler/Linker flags
263 OPTFLAGS = -O2 -fomit-frame-pointer
264 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
265 LDLIBS += -larossupport -lrom -lmui
267 else
268 ifeq ($(OS), aros-ppc)
270 ##############################
271 # AROS (PPC)
273 ifneq ($(HOST), AROS)
274 CC = ppc-aros-gcc
275 STRIP = ppc-aros-strip
276 OBJDUMP = ppc-aros-objdump
277 endif
279 # Compiler/Linker flags
280 OPTFLAGS = -O2 -fomit-frame-pointer
281 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
282 LDLIBS += -larossupport -lrom -lmui
284 else
285 ifeq ($(OS), aros-x86_64)
287 ##############################
288 # AROS (x86_64)
290 ifneq ($(HOST), AROS)
291 CC = x86_64-aros-gcc
292 STRIP = x86_64-aros-strip
293 OBJDUMP = x86_64-aros-objdump
294 endif
296 # Compiler/Linker flags
297 OPTFLAGS = -O2 -fomit-frame-pointer
298 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
299 LDLIBS += -larossupport -lrom -lmui
301 endif
302 endif
303 endif
304 endif
305 endif
306 endif
308 # main target
309 .PHONY: all
310 ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
311 # great, we have a dependecies file, let's make our target
312 all: $(BINDIR) $(OBJDIR) $(M68KSTUBS) $(TARGET) #$(TESTTARGET)
313 else
314 # no dependecies, create it and then call make again
315 all: depend
316 @make --no-print-directory all
317 endif
319 # for making a release we compile ALL target with no debug
320 release:
321 @echo " CC $<"
322 make OS=os4 clean
323 make OS=os4 DEBUG=
324 @echo " CC $<"
325 make OS=os3 clean
326 make OS=os3 DEBUG=
327 @echo " CC $<"
328 make OS=mos clean
329 make OS=mos DEBUG=
330 @echo " CC $<"
331 make OS=aros-i386 clean
332 make OS=aros-i386 DEBUG=
333 @echo " CC $<"
334 make OS=aros-ppc clean
335 make OS=aros-ppc DEBUG=
336 @echo " CC $<"
337 make OS=aros-x86_64 clean
338 make OS=aros-x86_64 DEBUG=
340 # make the object directories
341 $(OBJDIR):
342 @echo " MK $@"
343 @$(MKDIR) $(OBJDIR)
345 # make the binary directories
346 $(BINDIR):
347 @echo " MK $@"
348 @$(MKDIR) $(BINDIR)
350 # for compiling single .c files
351 $(OBJDIR)/%.o: %.c
352 @echo " CC $<"
353 @$(CC) $(CFLAGS) $< -o $@
355 $(OBJDIR)/mccclass_68k.o: ../include/mccclass_68k.c
356 @echo " CC $<"
357 @$(CC) $(CFLAGS) $< -o $@
359 # for linking the target
360 $(TARGET): $(M68KSTUBS) $(MCCOBJS)
361 @echo " LD $@.debug"
362 @$(CC) -nostartfiles $(LDFLAGS) -o $@.debug $(MCCOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
363 @echo " LD $@"
364 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
366 # for linking the target
367 $(TESTTARGET): $(TESTOBJS)
368 @echo " LD $@.debug"
369 @$(CC) $(LDFLAGS) -o $@.debug $(TESTOBJS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
370 @echo " LD $@"
371 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
373 .PHONY: dump
374 dump:
375 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET) >$(TARGET).dump
377 .PHONY: clean
378 clean:
379 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map
380 -$(RM) $(TESTTARGET) $(TESTTARGET).debug $(TESTTARGET).map
381 -$(RM) $(MCCOBJS) $(TESTOBJS) $(M68KSTUBS)
383 .PHONY: distclean
384 distclean: clean
385 -$(RMDIR) $(OBJDIR)
386 -$(RMDIR) $(BINDIR)
388 # install
389 .PHONY: install
390 install: all
391 @echo " IN $(TARGET)"
392 @$(CP) $(TARGET) $(DESTDIR)
394 .PHONY: help
395 help:
396 @echo "Cleaning targets:"
397 @echo " clean - Cleanup working directory for clean compile"
398 @echo " distclean - Also cleanup autogenerated files"
399 @echo ""
400 @echo "Other generic targets:"
401 @echo " all - Build $(TARGET)"
402 @echo " catalogs - Build all available catalogs"
403 @echo ""
404 @echo "Install targets:"
405 @echo " install - Install $(TARGET) into $(DESTDIR)"
406 @echo ""
407 @echo "Parameters:"
408 @echo " make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
409 @echo " make DEBUG= : build $(TARGET) without debugging information"
410 @echo ""
412 ## DEPENDENCY GENERATION ##############
414 .PHONY: depend
415 depend:
416 @echo " MK $(DEPFILE)"
417 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE)
418 @$(CC) -MM -MG $(CFLAGS) $(wildcard *.c) >>$(DEPFILE)
419 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE)
420 @$(SED) -i 's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE)
422 # include dependencies file
423 -include $(DEPFILE)