revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / zune / texteditor / demo / Makefile
blob99cbee337c24e7dd22e4cbe2a53c86a1d0e97402
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
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 CP = copy
111 CC = gcc
112 STRIP = strip
113 OBJDUMP = objdump
115 # path definitions
116 CDUP = /
117 CDTHIS=
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
126 RM = rm -f
127 RMDIR = rm -rf
128 MKDIR = mkdir -p
129 CHMOD = chmod 755
130 CP = cp -f
132 CDUP = ../
133 CDTHIS= ./
135 endif
136 endif
137 endif
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
142 # PPC-603e version
144 # OPTFLAGS are disabled by DEBUG normally!
146 # ignored warnings are:
147 # none - because we want to compile with -Wall all the time
149 # Common Directories
150 PREFIX = $(CDTHIS)
151 OBJDIR = .obj_$(OS)
152 BINDIR = bin_$(OS)
153 VPATH = $(OBJDIR)
154 DEPFILE = Makefile.dep
155 DESTDIR = MUI:Libs/MUI
157 # target definition
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
163 DEBUG = -DDEBUG -O0
164 DEBUGSYM = -g -gstabs
165 CFLAGS = -I. -I../mcp -I../include $(CPU) $(WARN) $(OPTFLAGS) \
166 $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS) -c
167 LDFLAGS = $(CPU) $(DEBUGSYM)
168 LDLIBS =
170 # different options per target OS
171 ifeq ($(OS), os4)
173 ##############################
174 # AmigaOS4
176 # Compiler/link/strip commands
177 ifneq ($(HOST), AmigaOS4)
178 CC = ppc-amigaos-gcc
179 STRIP = ppc-amigaos-strip
180 OBJDUMP = ppc-amigaos-objdump
181 endif
183 # Compiler/Linker flags
184 CRT = newlib
185 CPU = -mcpu=powerpc
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)
191 else
192 ifeq ($(OS), os3)
194 ##############################
195 # AmigaOS3
197 # Compiler/link/strip commands
198 ifneq ($(HOST), AmigaOS)
199 CC = m68k-amigaos-gcc
200 STRIP = m68k-amigaos-strip
201 OBJDUMP = m68k-amigaos-objdump
202 endif
204 # Compiler/Linker flags
205 CPU = -m68020-60 -msoft-float
206 CFLAGS += -noixemul -DNO_INLINE_STDARG
207 LDFLAGS += -noixemul
208 LDLIBS += -ldebug -lmui
210 else
211 ifeq ($(OS), mos)
213 ##############################
214 # MorphOS
216 # Compiler/link/strip commands
217 ifneq ($(HOST), MorphOS)
218 CC = ppc-morphos-gcc
219 STRIP = ppc-morphos-strip
220 OBJDUMP = ppc-morphos-objdump
221 endif
223 # Compiler/Linker flags
224 CPU = -mcpu=powerpc
225 CFLAGS += -noixemul -DNO_PPCINLINE_STDARG
226 LDFLAGS += -noixemul
227 LDLIBS += -ldebug
229 else
230 ifeq ($(OS), aros-i386)
232 ##############################
233 # AROS (i386)
235 ifneq ($(HOST), AROS)
236 CC = i386-aros-gcc
237 STRIP = i386-aros-strip
238 OBJDUMP = i386-aros-objdump
239 endif
241 # Compiler/Linker flags
242 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
243 LDLIBS += -larossupport -lrom -lmui
245 else
246 ifeq ($(OS), aros-ppc)
248 ##############################
249 # AROS (PPC)
251 ifneq ($(HOST), AROS)
252 CC = ppc-aros-gcc
253 STRIP = ppc-aros-strip
254 OBJDUMP = ppc-aros-objdump
255 endif
257 # Compiler/Linker flags
258 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
259 LDLIBS += -larossupport -lrom -lmui
261 else
262 ifeq ($(OS), aros-x86_64)
264 ##############################
265 # AROS (x86_64)
267 ifneq ($(HOST), AROS)
268 CC = x86_64-aros-gcc
269 STRIP = x86_64-aros-strip
270 OBJDUMP = x86_64-aros-objdump
271 endif
273 # Compiler/Linker flags
274 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
275 LDLIBS += -larossupport -lrom -lmui
277 endif
278 endif
279 endif
280 endif
281 endif
282 endif
284 ###########################################################################
285 # Here starts all stuff that is common for all target platforms and
286 # hosts.
288 OBJS = $(OBJDIR)/TextEditor-Demo.o \
289 $(OBJDIR)/vastubs.o
291 .PHONY: all
292 all: $(BINDIR) $(OBJDIR) $(TARGET)
294 # for making a release we compile ALL target with no debug
295 release:
296 @echo " CC $<"
297 make OS=os4 clean
298 make OS=os4 DEBUG=
299 @echo " CC $<"
300 make OS=os3 clean
301 make OS=os3 DEBUG=
302 @echo " CC $<"
303 make OS=mos clean
304 make OS=mos DEBUG=
305 @echo " CC $<"
306 make OS=aros-i386 clean
307 make OS=aros-i386 DEBUG=
308 @echo " CC $<"
309 make OS=aros-ppc clean
310 make OS=aros-ppc DEBUG=
311 @echo " CC $<"
312 make OS=aros-x86_64 clean
313 make OS=aros-x86_64 DEBUG=
315 # make the object directories
316 $(OBJDIR):
317 @echo " MK $@"
318 @$(MKDIR) $(OBJDIR)
320 # make the binary directories
321 $(BINDIR):
322 @echo " MK $@"
323 @$(MKDIR) $(BINDIR)
325 # for compiling single .c files
326 $(OBJDIR)/%.o: %.c
327 @echo " CC $<"
328 @$(CC) $(CFLAGS) $< -o $@
330 # for linking the target
331 $(TARGET): $(OBJS)
332 @echo " LD $@.debug"
333 @$(CC) $(LDFLAGS) -o $@.debug $(OBJS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
334 @echo " LD $@"
335 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
337 .PHONY: clean
338 clean:
339 -$(RM) $(TARGET) $(TARGET).debug $(OBJS)
341 .PHONY: distclean
342 distclean: clean
343 -$(RMDIR) $(OBJDIR)
344 -$(RMDIR) $(BINDIR)