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
116 # override commands for native builds
117 ifeq ($(HOST
), AmigaOS4
)
120 # RMDIR = delete force all
124 ifeq ($(HOST
), AmigaOS
)
127 RMDIR
= delete
force all
130 ifeq ($(HOST
), MorphOS
)
133 RMDIR
= delete
force all
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
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
168 # OPTFLAGS are disabled by DEBUG normally!
170 # ignored warnings are:
171 # none - because we want to compile with -Wall all the time
179 DEPFILE
= Makefile.dep
180 DESTDIR
= MUI
:Libs
/MUI
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
190 DEBUGSYM
= -g
-gstabs
191 CFLAGS
= -I.
-I..
/include $(CPU
) $(WARN
) $(OPTFLAGS
) \
192 $(DEBUG
) $(DEBUGSYM
) $(USER_CFLAGS
) -c
193 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
196 ###########################################################################
197 # object files definition
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
222 ##############################
225 # Compiler/link/strip commands
226 ifneq ($(HOST
), AmigaOS4
)
228 STRIP
= ppc-amigaos-strip
229 OBJDUMP
= ppc-amigaos-objdump
232 # Compiler/Linker flags
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
246 ##############################
249 # Compiler/link/strip commands
250 ifneq ($(HOST
), AmigaOS
)
251 CC
= m68k-amigaos-gcc
252 STRIP
= m68k-amigaos-strip
253 OBJDUMP
= m68k-amigaos-objdump
256 # Compiler/Linker flags
257 CPU
= -m68020-60
-msoft-float
258 CFLAGS
+= -noixemul
-DNO_INLINE_STDARG
-D__amigaos3__
260 LDLIBS
+= -ldebug
-lmui
262 # additional object files required
263 # additional object files required
273 ##############################
276 # Compiler/link/strip commands
277 ifneq ($(HOST
), MorphOS
)
279 STRIP
= ppc-morphos-strip
280 OBJDUMP
= ppc-morphos-objdump
283 # Compiler/Linker flags
290 ifeq ($(OS
), aros-i386
)
292 ##############################
295 ifneq ($(HOST
), AROS
)
297 STRIP
= i386-aros-strip
298 OBJDUMP
= i386-aros-objdump
301 # Compiler/Linker flags
302 OPTFLAGS
= -O2
-fomit-frame-pointer
303 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
304 LDLIBS
+= -larossupport
-lrom
-lmui
307 ifeq ($(OS
), aros-ppc
)
309 ##############################
312 ifneq ($(HOST
), AROS
)
314 STRIP
= ppc-aros-strip
315 OBJDUMP
= ppc-aros-objdump
318 # Compiler/Linker flags
319 OPTFLAGS
= -O2
-fomit-frame-pointer
320 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
321 LDLIBS
+= -larossupport
-lrom
-lmui
324 ifeq ($(OS
), aros-x86_64
)
326 ##############################
329 ifneq ($(HOST
), AROS
)
331 STRIP
= x86_64-aros-strip
332 OBJDUMP
= x86_64-aros-objdump
335 # Compiler/Linker flags
336 OPTFLAGS
= -O2
-fomit-frame-pointer
337 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
338 LDLIBS
+= -larossupport
-lrom
-lmui
349 ifeq ($(wildcard $(DEPFILE
)),$(DEPFILE
))
350 # great, we have a dependecies file, let's make our target
351 all: $(BINDIR
) $(OBJDIR
) $(M68KSTUBS
) $(TARGET
) $(TESTTARGET
)
353 # no dependecies, create it and then call make again
355 @make
--no-print-directory
all
358 # for making a release we compile ALL target with no debug
370 make OS
=aros-i386
clean
371 make OS
=aros-i386 DEBUG
=
373 make OS
=aros-ppc
clean
374 make OS
=aros-ppc DEBUG
=
376 make OS
=aros-x86_64
clean
377 make OS
=aros-x86_64 DEBUG
=
379 # make the object directories
383 @
$(MKDIR
) $(OBJDIR
)/extrasrc
385 # make the binary directories
390 # for compiling single .c files
393 @
$(CC
) $(CFLAGS
) $< -o
$@
395 $(OBJDIR
)/mccclass_68k.o
: ..
/include/mccclass_68k.c
397 @
$(CC
) $(CFLAGS
) $< -o
$@
399 $(LOCALE
)/%.catalog
: $(LOCALE
)/%.ct
$(LOCALE
)/TextEditor_mcp.cd
401 @
$(FC
) $(LOCALE
)/TextEditor_mcp.cd
$< CATALOG
$@
403 # for linking the target
404 $(TARGET
): $(M68KSTUBS
) $(MCPOBJS
)
406 @
$(CC
) -nostartfiles
$(LDFLAGS
) -o
$@.debug
$(MCPOBJS
) $(M68KSTUBS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
408 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
410 # for linking the target
411 $(TESTTARGET
): $(TESTOBJS
)
413 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(TESTOBJS
) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
415 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
418 locale.c
: $(LOCALE
)/TextEditor_mcp.pot C_h.sd C_c.sd
420 @
$(FC
) $(LOCALE
)/TextEditor_mcp.pot locale.h
=C_h.sd locale.c
=C_c.sd
422 ## CATALOG GENERATION #################
424 $(LOCALE
)/%.catalog
: $(LOCALE
)/%.po
426 @
$(FC
) POFILE
$< CATALOG
$@
430 catalogs
: $(CATALOGS
)
434 -$(OBJDUMP
) --section-headers
--all-headers
--reloc
--disassemble-all
$(TARGET
) >$(TARGET
).dump
438 -$(RM
) $(TARGET
) $(TARGET
).debug
$(TARGET
).map
439 -$(RM
) $(TESTTARGET
) $(TESTTARGET
).debug
$(TESTTARGET
).map
440 -$(RM
) $(MCPOBJS
) $(TESTOBJS
) $(M68KSTUBS
)
446 -$(RM
) $(LOCALE
)/*.catalog
453 @echo
" IN $(TARGET)"
454 @
$(CP
) $(TARGET
) $(DESTDIR
)
458 @echo
"Cleaning targets:"
459 @echo
" clean - Cleanup working directory for clean compile"
460 @echo
" distclean - Also cleanup autogenerated files"
462 @echo
"Other generic targets:"
463 @echo
" all - Build $(TARGET)"
464 @echo
" catalogs - Build all available catalogs"
466 @echo
"Install targets:"
467 @echo
" install - Install $(TARGET) into $(DESTDIR)"
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"
474 ## DEPENDENCY GENERATION ##############
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