1 #/***************************************************************************
3 # NList.mcc - New List MUI Custom Class
4 # Registered MUI class, Serial Number: 1d51 0x9d510030 to 0x9d5100A0
5 # 0x9d5100C0 to 0x9d5100FF
7 # Copyright (C) 1996-2001 by Gilles Masson
8 # Copyright (C) 2001-2005 by NList Open Source Team
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2.1 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # NList classes Support Site: http://www.sf.net/projects/nlist-classes
24 #***************************************************************************/
26 ###########################################################################
27 # This makefile is a very generic one. It tries to identify both, the host
28 # and the target operating system for which YAM should be compiled.
29 # However, this auto-detection can be easily overridden by directly
30 # specifying an option on the commandline while calling 'make'.
34 # # to explicitly compile for AmigaOS3
37 # # to compile for AmigaOS4 but with debugging
38 # > make OS=os4 DEBUG=
41 #############################################
42 # find out the HOST operating system
43 # on which this makefile is run
44 HOST ?
= $(shell uname
)
45 ifeq ($(HOST
), AmigaOS
)
46 ifeq ($(shell uname
-m
), powerpc
)
49 ifeq ($(shell uname
-m
), ppc
)
54 # if no host is identifed (no uname tool)
55 # we assume a AmigaOS build
60 #############################################
61 # now we find out the target OS for
62 # which we are going to compile YAM in case
63 # the caller didn't yet define OS himself
65 ifeq ($(HOST
), AmigaOS4
)
68 ifeq ($(HOST
), AmigaOS
)
71 ifeq ($(HOST
), MorphOS
)
75 # now we find out which CPU system aros will be used
76 ifeq ($(shell uname
-m
), powerpc
)
79 ifeq ($(shell uname
-m
), ppc
)
82 ifeq ($(shell uname
-m
), i386
)
85 ifeq ($(shell uname
-m
), i686
)
88 ifeq ($(shell uname
-m
), x86_64
)
99 #############################################
100 # define common commands we use in this
101 # makefile. Please note that each of them
102 # might be overridden on the commandline.
110 RMDIR
= delete
force all
112 CHMOD
= protect FLAGS
=rwed
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
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
148 # OPTFLAGS are disabled by DEBUG normally!
150 # ignored warnings are:
151 # none - because we want to compile with -Wall all the time
158 DEPFILE
= Makefile.dep
159 DESTDIR
= MUI
:Libs
/MUI
162 TARGET
= $(BINDIR
)/NList.mcc
163 TESTTARGET
= $(BINDIR
)/NList-Test
165 # Common compiler/linker flags
166 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
167 OPTFLAGS
= -O3
-fomit-frame-pointer
168 DEBUG
= -DDEBUG
-fno-omit-frame-pointer
-O0
169 DEBUGSYM
= -g
-gstabs
170 CFLAGS
= -I.
-I..
/nlistview_mcc
-I..
/nlistviews_mcp
-I..
/include $(CPU
) $(WARN
) \
171 $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
) -c
172 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
175 ###########################################################################
176 # object files definition
181 COBJS
= NList_mcc.o \
203 # different options per target OS
206 ##############################
209 # Compiler/link/strip commands
210 ifneq ($(HOST
), AmigaOS4
)
212 STRIP
= ppc-amigaos-strip
213 OBJDUMP
= ppc-amigaos-objdump
216 # Compiler/Linker flags
219 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
220 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
221 -DNO_PPCINLINE_STDARG
-Wa
,-mregnames
222 LDFLAGS
+= -mcrt
=$(CRT
)
224 # additional object files required
225 M68KSTUBS
= $(OBJDIR
)/mccclass_68k.o
230 ##############################
233 # Compiler/link/strip commands
234 ifneq ($(HOST
), AmigaOS
)
235 CC
= m68k-amigaos-gcc
236 STRIP
= m68k-amigaos-strip
237 OBJDUMP
= m68k-amigaos-objdump
240 # Compiler/Linker flags
241 CPU
= -m68020-60
-msoft-float
242 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
-D__amigaos3__
244 LDLIBS
+= -ldebug
-lmui
246 # additional object files required
248 extrasrc
/AllocVecPooled.o \
249 extrasrc
/FreeVecPooled.o
254 ##############################
257 # Compiler/link/strip commands
258 ifneq ($(HOST
), MorphOS
)
260 STRIP
= ppc-morphos-strip
261 OBJDUMP
= ppc-morphos-objdump
264 # Compiler/Linker flags
266 CFLAGS
+= -noixemul
-DNO_PPCINLINE_STDARG
271 ifeq ($(OS
), aros-i386
)
273 ##############################
276 ifneq ($(HOST
), AROS
)
278 STRIP
= i386-aros-strip
279 OBJDUMP
= i386-aros-objdump
282 # Compiler/Linker flags
283 OPTFLAGS
= -O2
-fomit-frame-pointer
284 CFLAGS
+= -Wno-pointer-sign
285 LDLIBS
+= -larossupport
-lrom
-lmui
288 ifeq ($(OS
), aros-ppc
)
290 ##############################
293 ifneq ($(HOST
), AROS
)
295 STRIP
= ppc-aros-strip
296 OBJDUMP
= ppc-aros-objdump
299 # Compiler/Linker flags
300 OPTFLAGS
= -O2
-fomit-frame-pointer
301 CFLAGS
+= -Wno-pointer-sign
302 LDLIBS
+= -larossupport
-lrom
-lmui
305 ifeq ($(OS
), aros-x86_64
)
307 ##############################
310 ifneq ($(HOST
), AROS
)
312 STRIP
= x86_64-aros-strip
313 OBJDUMP
= x86_64-aros-objdump
316 # Compiler/Linker flags
317 OPTFLAGS
= -O2
-fomit-frame-pointer
318 CFLAGS
+= -Wno-pointer-sign
319 LDLIBS
+= -larossupport
-lrom
-lmui
328 MCCOBJS
= $(addprefix $(OBJDIR
)/,$(LOBJS
)) $(addprefix $(OBJDIR
)/,$(COBJS
))
329 TESTOBJS
= $(addprefix $(OBJDIR
)/,$(COBJS
)) $(addprefix $(OBJDIR
)/,$(TOBJS
))
333 ifeq ($(wildcard $(DEPFILE
)),$(DEPFILE
))
334 # great, we have a dependecies file, let's make our target
335 all: $(BINDIR
) $(OBJDIR
) $(M68KSTUBS
) $(TARGET
) $(TESTTARGET
)
337 # no dependecies, create it and then call make again
339 @make
--no-print-directory
all
342 # for making a release we compile ALL target with no debug
354 make OS
=aros-i386
clean
355 make OS
=aros-i386 DEBUG
=
357 make OS
=aros-ppc
clean
358 make OS
=aros-ppc DEBUG
=
360 make OS
=aros-x86_64
clean
361 make OS
=aros-x86_64 DEBUG
=
363 # make the object directories
367 @
$(MKDIR
) $(OBJDIR
)/extrasrc
369 # make the binary directories
374 # for compiling single .c files
377 @
$(CC
) $(CFLAGS
) $< -o
$@
379 $(OBJDIR
)/mccclass_68k.o
: ..
/include/mccclass_68k.c
381 @
$(CC
) $(CFLAGS
) $< -o
$@
383 # for linking the target
384 $(TARGET
): $(M68KSTUBS
) $(MCCOBJS
)
386 @
$(CC
) -nostartfiles
$(LDFLAGS
) -o
$@.debug
$(MCCOBJS
) $(M68KSTUBS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
388 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
390 # for linking the target
391 $(TESTTARGET
): $(TESTOBJS
)
393 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(TESTOBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
395 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
399 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
) >$(TARGET
).dump
403 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
404 -$(RM
) $(TESTTARGET
) $(TESTTARGET
).debug
$(TESTTARGET
).map
405 -$(RM
) $(MCCOBJS
) $(TESTOBJS
) $(M68KSTUBS
)
415 @echo
" IN $(TARGET)"
416 @
$(CP
) $(TARGET
) $(DESTDIR
)
420 @echo
"Cleaning targets:"
421 @echo
" clean - Cleanup working directory for clean compile"
422 @echo
" distclean - Also cleanup autogenerated files"
424 @echo
"Other generic targets:"
425 @echo
" all - Build $(TARGET)"
426 @echo
" catalogs - Build all available catalogs"
428 @echo
"Install targets:"
429 @echo
" install - Install $(TARGET) into $(DESTDIR)"
432 @echo
" make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
433 @echo
" make DEBUG= : build $(TARGET) without debugging information"
436 ## DEPENDENCY GENERATION ##############
440 @echo
" MK $(DEPFILE)"
441 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE
)
442 @
$(CC
) -MM
-MG
$(CFLAGS
) $(wildcard *.c
) >>$(DEPFILE
)
443 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE
)
444 @
$(SED
) -i
's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE
)
446 # include dependencies file