1 #/***************************************************************************
3 # NListview.mcc - New Listview MUI Custom Class
4 # Registered MUI class, Serial Number: 1d51 (0x9d510020 to 0x9d51002F)
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
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'.
33 # # to explicitly compile for AmigaOS3
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
)
48 ifeq ($(shell uname
-m
), ppc
)
53 # if no host is identifed (no uname tool)
54 # we assume a AmigaOS build
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
64 ifeq ($(HOST
), AmigaOS4
)
67 ifeq ($(HOST
), AmigaOS
)
70 ifeq ($(HOST
), MorphOS
)
74 # now we find out which CPU system aros will be used
75 ifeq ($(shell uname
-m
), powerpc
)
78 ifeq ($(shell uname
-m
), ppc
)
81 ifeq ($(shell uname
-m
), i386
)
84 ifeq ($(shell uname
-m
), i686
)
87 ifeq ($(shell uname
-m
), x86_64
)
98 #############################################
99 # define common commands we use in this
100 # makefile. Please note that each of them
101 # might be overridden on the commandline.
108 RM
= rm -f
#delete force
109 RMDIR
= rm -rf
#delete force all
110 MKDIR
= mkdir
-p
#makedir force
111 CHMOD
= protect FLAGS
=rwed
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
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
147 # OPTFLAGS are disabled by DEBUG normally!
149 # ignored warnings are:
150 # none - because we want to compile with -Wall all the time
157 DEPFILE
= Makefile.dep
158 DESTDIR
= MUI
:Libs
/MUI
161 TARGET
= $(BINDIR
)/NListview.mcc
162 TESTTARGET
= $(BINDIR
)/NListview-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
) \
170 $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
) -c
171 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
174 ###########################################################################
175 # object files definition
180 COBJS
= NListview.o \
183 TOBJS
= #NListview-Test.o
185 MCCOBJS
= $(addprefix $(OBJDIR
)/,$(LOBJS
)) $(addprefix $(OBJDIR
)/,$(COBJS
))
186 TESTOBJS
= $(addprefix $(OBJDIR
)/,$(COBJS
)) $(addprefix $(OBJDIR
)/,$(TOBJS
))
188 # different options per target OS
191 ##############################
194 # Compiler/link/strip commands
195 ifneq ($(HOST
), AmigaOS4
)
197 STRIP
= ppc-amigaos-strip
198 OBJDUMP
= ppc-amigaos-objdump
201 # Compiler/Linker flags
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
215 ##############################
218 # Compiler/link/strip commands
219 ifneq ($(HOST
), AmigaOS
)
220 CC
= m68k-amigaos-gcc
221 STRIP
= m68k-amigaos-strip
222 OBJDUMP
= m68k-amigaos-objdump
225 # Compiler/Linker flags
226 CPU
= -m68020-60
-msoft-float
227 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
-D__amigaos3__
229 LDLIBS
+= -ldebug
-lmui
231 # additional object files required
237 ##############################
240 # Compiler/link/strip commands
241 ifneq ($(HOST
), MorphOS
)
243 STRIP
= ppc-morphos-strip
244 OBJDUMP
= ppc-morphos-objdump
247 # Compiler/Linker flags
249 CFLAGS
+= -noixemul
-DNO_PPCINLINE_STDARG
254 ifeq ($(OS
), aros-i386
)
256 ##############################
259 ifneq ($(HOST
), AROS
)
261 STRIP
= i386-aros-strip
262 OBJDUMP
= i386-aros-objdump
265 # Compiler/Linker flags
266 OPTFLAGS
= -O2
-fomit-frame-pointer
267 CFLAGS
+= -Wno-pointer-sign
268 LDLIBS
+= -larossupport
-lrom
-lmui
271 ifeq ($(OS
), aros-ppc
)
273 ##############################
276 ifneq ($(HOST
), AROS
)
278 STRIP
= ppc-aros-strip
279 OBJDUMP
= ppc-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-x86_64
)
290 ##############################
293 ifneq ($(HOST
), AROS
)
295 STRIP
= x86_64-aros-strip
296 OBJDUMP
= x86_64-aros-objdump
299 # Compiler/Linker flags
300 OPTFLAGS
= -O2
-fomit-frame-pointer
301 CFLAGS
+= -Wno-pointer-sign
302 LDLIBS
+= -larossupport
-lrom
-lmui
313 ifeq ($(wildcard $(DEPFILE
)),$(DEPFILE
))
314 # great, we have a dependecies file, let's make our target
315 all: $(BINDIR
) $(OBJDIR
) $(M68KSTUBS
) $(TARGET
) #$(TESTTARGET)
317 # no dependecies, create it and then call make again
319 @make
--no-print-directory
all
322 # for making a release we compile ALL target with no debug
334 make OS
=aros-i386
clean
335 make OS
=aros-i386 DEBUG
=
337 make OS
=aros-ppc
clean
338 make OS
=aros-ppc DEBUG
=
340 make OS
=aros-x86_64
clean
341 make OS
=aros-x86_64 DEBUG
=
343 # make the object directories
348 # make the binary directories
353 # for compiling single .c files
356 @
$(CC
) $(CFLAGS
) $< -o
$@
358 $(OBJDIR
)/mccclass_68k.o
: ..
/include/mccclass_68k.c
360 @
$(CC
) $(CFLAGS
) $< -o
$@
362 # for linking the target
363 $(TARGET
): $(M68KSTUBS
) $(MCCOBJS
)
365 @
$(CC
) -nostartfiles
$(LDFLAGS
) -o
$@.debug
$(MCCOBJS
) $(M68KSTUBS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
367 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
369 # for linking the target
370 $(TESTTARGET
): $(TESTOBJS
)
372 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(TESTOBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
374 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
378 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
) >$(TARGET
).dump
382 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
383 -$(RM
) $(TESTTARGET
) $(TESTTARGET
).debug
$(TESTTARGET
).map
384 -$(RM
) $(MCCOBJS
) $(TESTOBJS
) $(M68KSTUBS
)
394 @echo
" IN $(TARGET)"
395 @
$(CP
) $(TARGET
) $(DESTDIR
)
399 @echo
"Cleaning targets:"
400 @echo
" clean - Cleanup working directory for clean compile"
401 @echo
" distclean - Also cleanup autogenerated files"
403 @echo
"Other generic targets:"
404 @echo
" all - Build $(TARGET)"
405 @echo
" catalogs - Build all available catalogs"
407 @echo
"Install targets:"
408 @echo
" install - Install $(TARGET) into $(DESTDIR)"
411 @echo
" make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
412 @echo
" make DEBUG= : build $(TARGET) without debugging information"
415 ## DEPENDENCY GENERATION ##############
419 @echo
" MK $(DEPFILE)"
420 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE
)
421 @
$(CC
) -MM
-MG
$(CFLAGS
) $(wildcard *.c
) >>$(DEPFILE
)
422 @echo
"# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE
)
423 @
$(SED
) -i
's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE
)
425 # include dependencies file