revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / zune / texteditor / mcp / Makefile
blobd8a54c6c64cf31f8d7e26a3437c40525411894dd
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 # override commands for native builds
117 ifeq ($(HOST), AmigaOS4)
118 # AmigaOS4 host
119 # RM = delete force
120 # RMDIR = delete force all
121 # MKDIR = makedir
122 DATE = gdate
123 else
124 ifeq ($(HOST), AmigaOS)
125 # AmigaOS3 host
126 RM = delete force
127 RMDIR = delete force all
128 MKDIR = makedir
129 else
130 ifeq ($(HOST), MorphOS)
131 # MorphOS host
132 RM = delete force
133 RMDIR = delete force all
134 MKDIR = makedir
135 endif
136 endif
137 endif
139 # path definitions
140 CDUP = /
141 CDTHIS=
143 # override some variables for non-native builds (cross-compiler)
144 ifneq ($(HOST), AmigaOS)
145 ifneq ($(HOST), AmigaOS4)
146 ifneq ($(HOST), MorphOS)
148 # when we end up here this is either a unix or Aros host
149 # so lets use unix kind of commands
150 RM = rm -f
151 RMDIR = rm -rf
152 MKDIR = mkdir -p
153 CHMOD = chmod 755
154 CP = cp -f
156 CDUP = ../
157 CDTHIS= ./
159 endif
160 endif
161 endif
163 ###########################################################################
164 # CPU and DEBUG can be defined outside, defaults to above
165 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
166 # PPC-603e version
168 # OPTFLAGS are disabled by DEBUG normally!
170 # ignored warnings are:
171 # none - because we want to compile with -Wall all the time
173 # Common Directories
174 PREFIX = $(CDTHIS)
175 OBJDIR = .obj_$(OS)
176 BINDIR = bin_$(OS)
177 VPATH = $(OBJDIR)
178 LOCALE = locale
179 DEPFILE = Makefile.dep
180 DESTDIR = MUI:Libs/MUI
182 # target definition
183 TARGET = $(BINDIR)/TextEditor.mcp
184 TESTTARGET= $(BINDIR)/TextEditor-Prefs
186 # Common compiler/linker flags
187 WARN = -W -Wall -Wwrite-strings -Wpointer-arith -Wsign-compare
188 OPTFLAGS = -O3 -fomit-frame-pointer
189 DEBUG = -DDEBUG -O0
190 DEBUGSYM = -g -gstabs
191 CFLAGS = -I. -I../include $(CPU) $(WARN) $(OPTFLAGS) \
192 $(DEBUG) $(DEBUGSYM) $(USER_CFLAGS) -c
193 LDFLAGS = $(CPU) $(DEBUGSYM)
194 LDLIBS =
196 ###########################################################################
197 # object files definition
200 LOBJS = library.o
202 COBJS = locale.o \
203 CreatePrefsGroup.o \
204 Dispatcher.o \
205 Keybindings.o \
206 KeyStorage.o \
207 ObjectCreator.o \
208 Debug.o \
209 icon.o
211 TOBJS = Preference.o
213 MCPOBJS = $(addprefix $(OBJDIR)/,$(LOBJS)) $(addprefix $(OBJDIR)/,$(COBJS))
214 TESTOBJS = $(addprefix $(OBJDIR)/,$(COBJS)) $(addprefix $(OBJDIR)/,$(TOBJS))
216 # available catalog translations
217 CATALOGS = $(patsubst %.po,%.catalog,$(wildcard $(LOCALE)/*.po))
219 # different options per target OS
220 ifeq ($(OS), os4)
222 ##############################
223 # AmigaOS4
225 # Compiler/link/strip commands
226 ifneq ($(HOST), AmigaOS4)
227 CC = ppc-amigaos-gcc
228 STRIP = ppc-amigaos-strip
229 OBJDUMP = ppc-amigaos-objdump
230 endif
232 # Compiler/Linker flags
233 CRT = newlib
234 CPU = -mcpu=powerpc
235 WARN += -Wdeclaration-after-statement -Wdisabled-optimization
236 CFLAGS += -mcrt=$(CRT) -D__USE_INLINE__ -D__NEW_TIMEVAL_DEFINITION_USED__ \
237 -DNO_PPCINLINE_STDARG -Wa,-mregnames
238 LDFLAGS += -mcrt=$(CRT)
240 # additional object files required
241 M68KSTUBS = $(OBJDIR)/mccclass_68k.o
243 else
244 ifeq ($(OS), os3)
246 ##############################
247 # AmigaOS3
249 # Compiler/link/strip commands
250 ifneq ($(HOST), AmigaOS)
251 CC = m68k-amigaos-gcc
252 STRIP = m68k-amigaos-strip
253 OBJDUMP = m68k-amigaos-objdump
254 endif
256 # Compiler/Linker flags
257 CPU = -m68020-60 -msoft-float
258 CFLAGS += -noixemul -DNO_INLINE_STDARG -D__amigaos3__
259 LDFLAGS += -noixemul
260 LDLIBS += -ldebug -lmui
262 # additional object files required
263 # additional object files required
264 COBJS += vastubs.o \
265 extrasrc/GetHead.o \
266 extrasrc/GetPred.o \
267 extrasrc/GetSucc.o \
268 extrasrc/GetTail.o
270 else
271 ifeq ($(OS), mos)
273 ##############################
274 # MorphOS
276 # Compiler/link/strip commands
277 ifneq ($(HOST), MorphOS)
278 CC = ppc-morphos-gcc
279 STRIP = ppc-morphos-strip
280 OBJDUMP = ppc-morphos-objdump
281 endif
283 # Compiler/Linker flags
284 CPU = -mcpu=powerpc
285 CFLAGS += -noixemul
286 LDFLAGS += -noixemul
287 LDLIBS += -ldebug
289 else
290 ifeq ($(OS), aros-i386)
292 ##############################
293 # AROS (i386)
295 ifneq ($(HOST), AROS)
296 CC = i386-aros-gcc
297 STRIP = i386-aros-strip
298 OBJDUMP = i386-aros-objdump
299 endif
301 # Compiler/Linker flags
302 OPTFLAGS = -O2 -fomit-frame-pointer
303 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
304 LDLIBS += -larossupport -lrom -lmui
306 else
307 ifeq ($(OS), aros-ppc)
309 ##############################
310 # AROS (PPC)
312 ifneq ($(HOST), AROS)
313 CC = ppc-aros-gcc
314 STRIP = ppc-aros-strip
315 OBJDUMP = ppc-aros-objdump
316 endif
318 # Compiler/Linker flags
319 OPTFLAGS = -O2 -fomit-frame-pointer
320 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
321 LDLIBS += -larossupport -lrom -lmui
323 else
324 ifeq ($(OS), aros-x86_64)
326 ##############################
327 # AROS (x86_64)
329 ifneq ($(HOST), AROS)
330 CC = x86_64-aros-gcc
331 STRIP = x86_64-aros-strip
332 OBJDUMP = x86_64-aros-objdump
333 endif
335 # Compiler/Linker flags
336 OPTFLAGS = -O2 -fomit-frame-pointer
337 CFLAGS += -Wno-pointer-sign -DNO_INLINE_STDARG
338 LDLIBS += -larossupport -lrom -lmui
340 endif
341 endif
342 endif
343 endif
344 endif
345 endif
347 # main target
348 .PHONY: all
349 ifeq ($(wildcard $(DEPFILE)),$(DEPFILE))
350 # great, we have a dependecies file, let's make our target
351 all: $(BINDIR) $(OBJDIR) $(M68KSTUBS) $(TARGET) $(TESTTARGET)
352 else
353 # no dependecies, create it and then call make again
354 all: depend
355 @make --no-print-directory all
356 endif
358 # for making a release we compile ALL target with no debug
359 release:
360 @echo " CC $<"
361 make OS=os4 clean
362 make OS=os4 DEBUG=
363 @echo " CC $<"
364 make OS=os3 clean
365 make OS=os3 DEBUG=
366 @echo " CC $<"
367 make OS=mos clean
368 make OS=mos DEBUG=
369 @echo " CC $<"
370 make OS=aros-i386 clean
371 make OS=aros-i386 DEBUG=
372 @echo " CC $<"
373 make OS=aros-ppc clean
374 make OS=aros-ppc DEBUG=
375 @echo " CC $<"
376 make OS=aros-x86_64 clean
377 make OS=aros-x86_64 DEBUG=
379 # make the object directories
380 $(OBJDIR):
381 @echo " MK $@"
382 @$(MKDIR) $(OBJDIR)
383 @$(MKDIR) $(OBJDIR)/extrasrc
385 # make the binary directories
386 $(BINDIR):
387 @echo " MK $@"
388 @$(MKDIR) $(BINDIR)
390 # for compiling single .c files
391 $(OBJDIR)/%.o: %.c
392 @echo " CC $<"
393 @$(CC) $(CFLAGS) $< -o $@
395 $(OBJDIR)/mccclass_68k.o: ../include/mccclass_68k.c
396 @echo " CC $<"
397 @$(CC) $(CFLAGS) $< -o $@
399 $(LOCALE)/%.catalog: $(LOCALE)/%.ct $(LOCALE)/TextEditor_mcp.cd
400 @echo " MK $@"
401 @$(FC) $(LOCALE)/TextEditor_mcp.cd $< CATALOG $@
403 # for linking the target
404 $(TARGET): $(M68KSTUBS) $(MCPOBJS)
405 @echo " LD $@.debug"
406 @$(CC) -nostartfiles $(LDFLAGS) -o $@.debug $(MCPOBJS) $(M68KSTUBS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
407 @echo " LD $@"
408 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
410 # for linking the target
411 $(TESTTARGET): $(TESTOBJS)
412 @echo " LD $@.debug"
413 @$(CC) $(LDFLAGS) -o $@.debug $(TESTOBJS) $(LDLIBS) -Wl,--cref,-M,-Map=$@.map
414 @echo " LD $@"
415 @$(STRIP) --preserve-dates -R.comment -R.sdata2 -S -o $@ $@.debug
417 locale.h: locale.c
418 locale.c: $(LOCALE)/TextEditor_mcp.pot C_h.sd C_c.sd
419 @echo " MK $@"
420 @$(FC) $(LOCALE)/TextEditor_mcp.pot locale.h=C_h.sd locale.c=C_c.sd
422 ## CATALOG GENERATION #################
424 $(LOCALE)/%.catalog: $(LOCALE)/%.po
425 @echo " MK $@"
426 @$(FC) POFILE $< CATALOG $@
428 .IGNORE: $(CATALOGS)
430 catalogs: $(CATALOGS)
432 .PHONY: dump
433 dump:
434 -$(OBJDUMP) --section-headers --all-headers --reloc --disassemble-all $(TARGET) >$(TARGET).dump
436 .PHONY: clean
437 clean:
438 -$(RM) $(TARGET) $(TARGET).debug $(TARGET).map
439 -$(RM) $(TESTTARGET) $(TESTTARGET).debug $(TESTTARGET).map
440 -$(RM) $(MCPOBJS) $(TESTOBJS) $(M68KSTUBS)
441 -$(RM) $(CATALOGS)
443 .PHONY: distclean
444 distclean: clean
445 -$(RM) locale.?
446 -$(RM) $(LOCALE)/*.catalog
447 -$(RMDIR) $(OBJDIR)
448 -$(RMDIR) $(BINDIR)
450 # install
451 .PHONY: install
452 install: all
453 @echo " IN $(TARGET)"
454 @$(CP) $(TARGET) $(DESTDIR)
456 .PHONY: help
457 help:
458 @echo "Cleaning targets:"
459 @echo " clean - Cleanup working directory for clean compile"
460 @echo " distclean - Also cleanup autogenerated files"
461 @echo ""
462 @echo "Other generic targets:"
463 @echo " all - Build $(TARGET)"
464 @echo " catalogs - Build all available catalogs"
465 @echo ""
466 @echo "Install targets:"
467 @echo " install - Install $(TARGET) into $(DESTDIR)"
468 @echo ""
469 @echo "Parameters:"
470 @echo " make OS=os3|os4|mos|aros-i386|aros-i686|aros-ppc|aros-x86_64"
471 @echo " make DEBUG= : build $(TARGET) without debugging information"
472 @echo ""
474 ## DEPENDENCY GENERATION ##############
476 .PHONY: depend
477 depend:
478 @echo " MK $(DEPFILE)"
479 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >$(DEPFILE)
480 @$(CC) -MM -MG $(CFLAGS) $(wildcard *.c) >>$(DEPFILE)
481 @echo "# AUTOGENERATED! DO NOT EDIT!!!" >>$(DEPFILE)
482 @$(SED) -i 's,^\(.*\)\.o:,$$\(OBJDIR\)/\1.o:,g' $(DEPFILE)
484 # include dependencies file
485 -include $(DEPFILE)