arch/cpu.resource: remove dead code
[AROS.git] / workbench / classes / zune / texteditor / mcc / Makefile
blob46f71d9a6002a77efb93549c8e3a4317e179c542
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 SED = sed
111 CP = copy
112 CC = gcc
113 STRIP = strip
114 OBJDUMP = objdump
116 # path definitions
117 CDUP = /
118 CDTHIS=
120 # override some variables for non-native builds (cross-compiler)
121 ifneq ($(HOST), AmigaOS)
122 ifneq ($(HOST), AmigaOS4)
123 ifneq ($(HOST), MorphOS)
125 # when we end up here this is either a unix or Aros host
126 # so lets use unix kind of commands
127 RM = rm -f
128 RMDIR = rm -rf
129 MKDIR = mkdir -p
130 CHMOD = chmod 755
131 CP = cp -f
133 CDUP = ../
134 CDTHIS= ./
136 endif
137 endif
138 endif
140 ###########################################################################
141 # CPU and DEBUG can be defined outside, defaults to above
142 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
143 # PPC-603e version
145 # OPTFLAGS are disabled by DEBUG normally!
147 # ignored warnings are:
148 # none - because we want to compile with -Wall all the time
150 # Common Directories
151 PREFIX = $(CDTHIS)
152 OBJDIR = .obj_$(OS)
153 BINDIR = bin_$(OS)
154 VPATH = $(OBJDIR)
155 DEPFILE = Makefile.dep
156 DESTDIR = MUI:Libs/MUI
158 # target definition
159 TARGET = $(BINDIR)/TextEditor.mcc
160 TESTTARGET= $(BINDIR)/TextEditor-Test
162 # Common compiler/linker flags
163 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
164 OPTFLAGS = -O3 -fomit-frame-pointer
165 DEBUG = -DDEBUG -O0
166 DEBUGSYM = -g -gstabs
167 CFLAGS = -I. -I../mcp -I../include $(CPU) $(WARN) $(OPTFLAGS) \
168 $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS) -c
169 LDFLAGS = $(CPU) $(DEBUGSYM)
170 LDLIBS =
172 ###########################################################################
173 # object files definition
176 LOBJS = library.o
178 COBJS = AllocBitMap.o \
179 BlockOperators.o \
180 CaseConversion.o \
181 ClipboardServer.o \
182 ColorOperators.o \
183 Dispatcher.o \
184 EditorStuff.o \
185 ExportHook.o \
186 ExportBlock.o \
187 ExportText.o \
188 GetSetAttrs.o \
189 Grow.o \
190 HandleARexx.o \
191 HandleInput.o \
192 InitConfig.o \
193 ImportHook.o \
194 ImportText.o \
195 Keybindings.o \
196 Methods.o \
197 MixedFunctions.o \
198 Navigation.o \
199 Pointer.o \
200 PrintLineWithStyles.o \
201 Search.o \
202 SetBlock.o \
203 SpellChecker.o \
204 StyleOperators.o \
205 UndoFunctions.o \
206 NewGfx.o \
207 Debug.o
209 TOBJS = TextEditor-Test.o
211 MCCOBJS = $(addprefix $(OBJDIR)/,$(LOBJS)) $(addprefix $(OBJDIR)/,$(COBJS))
212 TESTOBJS = $(addprefix $(OBJDIR)/,$(COBJS)) $(addprefix $(OBJDIR)/,$(TOBJS))
214 # different options per target OS
215 ifeq ($(OS), os4)
217 ##############################
218 # AmigaOS4
220 # Compiler/link/strip commands
221 ifneq ($(HOST), AmigaOS4)
222 CC = ppc-amigaos-gcc
223 STRIP = ppc-amigaos-strip
224 OBJDUMP = ppc-amigaos-objdump
225 endif
227 # Compiler/Linker flags
228 CRT = newlib
229 CPU = -mcpu=powerpc
230 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
231 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
232 -DNO_PPCINLINE_STDARG -Wa,-mregnames
233 LDFLAGS += -mcrt=$(CRT)
235 # additional object files required
236 M68KSTUBS = $(OBJDIR)/mccclass_68k.o
238 else
239 ifeq ($(OS), os3)
241 ##############################
242 # AmigaOS3
244 # Compiler/link/strip commands
245 ifneq ($(HOST), AmigaOS)
246 CC = m68k-amigaos-gcc
247 STRIP = m68k-amigaos-strip
248 OBJDUMP = m68k-amigaos-objdump
249 endif
251 # Compiler/Linker flags
252 CPU = -m68020-60 -msoft-float
253 CFLAGS += -noixemul -DNO_INLINE_STDARG -D__amigaos3__
254 LDFLAGS += -noixemul
255 LDLIBS += -ldebug -lmui
257 # additional object files required
258 COBJS += vastubs.o \
259 extrasrc/AllocVecPooled.o \
260 extrasrc/FreeVecPooled.o \
261 extrasrc/GetHead.o \
262 extrasrc/GetPred.o \
263 extrasrc/GetSucc.o \
264 extrasrc/GetTail.o \
265 extrasrc/MoveList.o
267 else
268 ifeq ($(OS), mos)
270 ##############################
271 # MorphOS
273 # Compiler/link/strip commands
274 ifneq ($(HOST), MorphOS)
275 CC = ppc-morphos-gcc
276 STRIP = ppc-morphos-strip
277 OBJDUMP = ppc-morphos-objdump
278 endif
280 # Compiler/Linker flags
281 CPU = -mcpu=powerpc
282 CFLAGS += -noixemul
283 LDFLAGS += -noixemul
284 LDLIBS += -ldebug
286 # additional object files required
287 COBJS += extrasrc/MoveList.o \
288 extrasrc/GetHead.o \
289 extrasrc/GetPred.o \
290 extrasrc/GetSucc.o \
291 extrasrc/GetTail.o
293 else
294 ifeq ($(OS), aros-i386)
296 ##############################
297 # AROS (i386)
299 ifneq ($(HOST), AROS)
300 CC = i386-aros-gcc
301 STRIP = i386-aros-strip
302 OBJDUMP = i386-aros-objdump
303 endif
305 # Compiler/Linker flags
306 OPTFLAGS = -O2 -fomit-frame-pointer
307 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
308 LDLIBS += -larossupport -lrom -lmui
310 # additional object files required
311 COBJS += extrasrc/MoveList.o
313 else
314 ifeq ($(OS), aros-ppc)
316 ##############################
317 # AROS (PPC)
319 ifneq ($(HOST), AROS)
320 CC = ppc-aros-gcc
321 STRIP = ppc-aros-strip
322 OBJDUMP = ppc-aros-objdump
323 endif
325 # Compiler/Linker flags
326 OPTFLAGS = -O2 -fomit-frame-pointer
327 CFLAGS += -Wno-pointer-sign
328 LDLIBS += -larossupport -lrom -lmui
330 # additional object files required
331 COBJS += extrasrc/MoveList.o
333 else
334 ifeq ($(OS), aros-x86_64)
336 ##############################
337 # AROS (x86_64)
339 ifneq ($(HOST), AROS)
340 CC = x86_64-aros-gcc
341 STRIP = x86_64-aros-strip
342 OBJDUMP = x86_64-aros-objdump
343 endif
345 # Compiler/Linker flags
346 OPTFLAGS = -O2 -fomit-frame-pointer
347 CFLAGS += -Wno-pointer-sign
348 LDLIBS += -larossupport -lrom -lmui
350 # additional object files required
351 COBJS += extrasrc/MoveList.o
353 endif
354 endif
355 endif
356 endif
357 endif
358 endif
360 # main target
361 .PHONY: all
362 ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
363 # great, we have a dependecies file, let's make our target
364 all: $(BINDIR) $(OBJDIR) $(M68KSTUBS) $(TARGET) $(TESTTARGET)
365 else
366 # no dependecies, create it and then call make again
367 all: depend
368 @make --no-print-directory all
369 endif
371 # for making a release we compile ALL target with no debug
372 release:
373 @echo " CC $<"
374 make OS=os4 clean
375 make OS=os4 DEBUG=
376 @echo " CC $<"
377 make OS=os3 clean
378 make OS=os3 DEBUG=
379 @echo " CC $<"
380 make OS=mos clean
381 make OS=mos DEBUG=
382 @echo " CC $<"
383 make OS=aros-i386 clean
384 make OS=aros-i386 DEBUG=
385 @echo " CC $<"
386 make OS=aros-ppc clean
387 make OS=aros-ppc DEBUG=
388 @echo " CC $<"
389 make OS=aros-x86_64 clean
390 make OS=aros-x86_64 DEBUG=
392 # make the object directories
393 $(OBJDIR):
394 @echo " MK $@"
395 @$(MKDIR) $(OBJDIR)
396 @$(MKDIR) $(OBJDIR)/extrasrc
398 # make the binary directories
399 $(BINDIR):
400 @echo " MK $@"
401 @$(MKDIR) $(BINDIR)
403 # for compiling single .c files
404 $(OBJDIR)/%.o: %.c
405 @echo " CC $<"
406 @$(CC) $(CFLAGS) $< -o $@
408 $(OBJDIR)/mccclass_68k.o: ../include/mccclass_68k.c
409 @echo " CC $<"
410 @$(CC) $(CFLAGS) $< -o $@
412 # for linking the target
413 $(TARGET): $(M68KSTUBS) $(MCCOBJS)
414 @echo " LD $@.debug"
415 @$(CC) -nostartfiles $(LDFLAGS) -o $@.debug $(MCCOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
416 @echo " LD $@"
417 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
419 # for linking the target
420 $(TESTTARGET): $(TESTOBJS)
421 @echo " LD $@.debug"
422 @$(CC) $(LDFLAGS) -o $@.debug $(TESTOBJS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
423 @echo " LD $@"
424 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
426 .PHONY: dump
427 dump:
428 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET) > $(TARGET).dump
430 .PHONY: clean
431 clean:
432 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map
433 -$(RM) $(TESTTARGET) $(TESTTARGET).debug $(TESTTARGET).map
434 -$(RM) $(MCCOBJS) $(TESTOBJS) $(M68KSTUBS)
436 .PHONY: distclean
437 distclean: clean
438 -$(RMDIR) $(OBJDIR)
439 -$(RMDIR) $(BINDIR)
441 # install
442 .PHONY: install
443 install: all
444 @echo " IN $(TARGET)"
445 @$(CP) $(TARGET) $(DESTDIR)
447 .PHONY: help
448 help:
449 @echo "Cleaning targets:"
450 @echo " clean - Cleanup working directory for clean compile"
451 @echo " distclean - Also cleanup autogenerated files"
452 @echo ""
453 @echo "Other generic targets:"
454 @echo " all - Build $(TARGET)"
455 @echo " catalogs - Build all available catalogs"
456 @echo ""
457 @echo "Install targets:"
458 @echo " install - Install $(TARGET) into $(DESTDIR)"
459 @echo ""
460 @echo "Parameters:"
461 @echo " make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
462 @echo " make DEBUG= : build $(TARGET) without debugging information"
463 @echo ""
465 ## DEPENDENCY GENERATION ##############
467 .PHONY: depend
468 depend:
469 @echo " MK $(DEPFILE)"
470 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE)
471 @$(CC) -MM -MG $(CFLAGS) $(wildcard *.c) >>$(DEPFILE)
472 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE)
473 @$(SED) -i 's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE)
475 # include dependencies file
476 -include $(DEPFILE)