1 #/***************************************************************************
3 # TextEditor.mcc - Textediting MUI Custom Class
4 # Copyright (C) 1997-2000 Allan Odgaard
5 # Copyright (C) 2005-2014 TextEditor.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 # TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
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'.
31 # # to explicitly compile for AmigaOS3
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
)
46 ifeq ($(shell uname
-m
), ppc
)
51 # if no host is identifed (no uname tool)
52 # we assume a AmigaOS build
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
62 ifeq ($(HOST
), AmigaOS4
)
65 ifeq ($(HOST
), AmigaOS
)
68 ifeq ($(HOST
), MorphOS
)
72 # now we find out which CPU system aros will be used
73 ifeq ($(shell uname
-m
), powerpc
)
76 ifeq ($(shell uname
-m
), ppc
)
79 ifeq ($(shell uname
-m
), i386
)
82 ifeq ($(shell uname
-m
), i686
)
85 ifeq ($(shell uname
-m
), x86_64
)
96 #############################################
97 # define common commands we use in this
98 # makefile. Please note that each of them
99 # might be overridden on the commandline.
107 RMDIR
= delete
force all
109 CHMOD
= protect FLAGS
=rwed
119 # override some variables for non-native builds (cross-compiler)
120 ifneq ($(HOST
), AmigaOS
)
121 ifneq ($(HOST
), AmigaOS4
)
122 ifneq ($(HOST
), MorphOS
)
124 # when we end up here this is either a unix or Aros host
125 # so lets use unix kind of commands
139 ###########################################################################
140 # CPU and DEBUG can be defined outside, defaults to above
141 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
144 # OPTFLAGS are disabled by DEBUG normally!
146 # ignored warnings are:
147 # none - because we want to compile with -Wall all the time
154 DEPFILE
= Makefile.dep
155 DESTDIR
= MUI
:Libs
/MUI
158 TARGET
= $(BINDIR
)/TextEditor-Demo
160 # Common compiler/linker flags
161 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
162 OPTFLAGS
= -O3
-fomit-frame-pointer
164 DEBUGSYM
= -g
-gstabs
165 CFLAGS
= -I.
-I..
/mcp
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) \
166 $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
) -c
167 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
170 # different options per target OS
173 ##############################
176 # Compiler/link/strip commands
177 ifneq ($(HOST
), AmigaOS4
)
179 STRIP
= ppc-amigaos-strip
180 OBJDUMP
= ppc-amigaos-objdump
183 # Compiler/Linker flags
186 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
187 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
188 -DNO_PPCINLINE_STDARG
-Wa
,-mregnames
189 LDFLAGS
+= -mcrt
=$(CRT
)
194 ##############################
197 # Compiler/link/strip commands
198 ifneq ($(HOST
), AmigaOS
)
199 CC
= m68k-amigaos-gcc
200 STRIP
= m68k-amigaos-strip
201 OBJDUMP
= m68k-amigaos-objdump
204 # Compiler/Linker flags
205 CPU
= -m68020-60
-msoft-float
206 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
208 LDLIBS
+= -ldebug
-lmui
213 ##############################
216 # Compiler/link/strip commands
217 ifneq ($(HOST
), MorphOS
)
219 STRIP
= ppc-morphos-strip
220 OBJDUMP
= ppc-morphos-objdump
223 # Compiler/Linker flags
225 CFLAGS
+= -noixemul
-DNO_PPCINLINE_STDARG
230 ifeq ($(OS
), aros-i386
)
232 ##############################
235 ifneq ($(HOST
), AROS
)
237 STRIP
= i386-aros-strip
238 OBJDUMP
= i386-aros-objdump
241 # Compiler/Linker flags
242 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
243 LDLIBS
+= -larossupport
-lrom
-lmui
246 ifeq ($(OS
), aros-ppc
)
248 ##############################
251 ifneq ($(HOST
), AROS
)
253 STRIP
= ppc-aros-strip
254 OBJDUMP
= ppc-aros-objdump
257 # Compiler/Linker flags
258 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
259 LDLIBS
+= -larossupport
-lrom
-lmui
262 ifeq ($(OS
), aros-x86_64
)
264 ##############################
267 ifneq ($(HOST
), AROS
)
269 STRIP
= x86_64-aros-strip
270 OBJDUMP
= x86_64-aros-objdump
273 # Compiler/Linker flags
274 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
275 LDLIBS
+= -larossupport
-lrom
-lmui
284 ###########################################################################
285 # Here starts all stuff that is common for all target platforms and
288 OBJS
= $(OBJDIR
)/TextEditor-Demo.o \
292 all: $(BINDIR
) $(OBJDIR
) $(TARGET
)
294 # for making a release we compile ALL target with no debug
306 make OS
=aros-i386
clean
307 make OS
=aros-i386 DEBUG
=
309 make OS
=aros-ppc
clean
310 make OS
=aros-ppc DEBUG
=
312 make OS
=aros-x86_64
clean
313 make OS
=aros-x86_64 DEBUG
=
315 # make the object directories
320 # make the binary directories
325 # for compiling single .c files
328 @
$(CC
) $(CFLAGS
) $< -o
$@
330 # for linking the target
333 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(OBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
335 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
339 -$(RM
) $(TARGET
) $(TARGET
).debug
$(OBJS
)