1 #/***************************************************************************
5 # Copyright (C) 1993-1999 by Jochen Wiedmann and Marcin Orlowski
6 # Copyright (C) 2002-2010 by the FlexCat Open Source Team
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or (at
11 # your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #***************************************************************************/
24 ###########################################################################
25 # This makefile is a very generic one. It tries to identify both, the host
26 # and the target operating system for which FlexCat should be compiled.
27 # However, this auto-detection can be easily overridden by directly
28 # specifying an option on the commandline while calling 'make'.
32 # # to explicitly compile for AmigaOS3
35 # # to compile for AmigaOS4 but without debugging
36 # > make OS=os4 DEBUG=
39 #############################################
40 # find out the HOST operating system
41 # on which this makefile is run
42 HOST ?
= $(shell uname
)
43 ifeq ($(HOST
), AmigaOS
)
44 ifeq ($(shell uname
-m
), powerpc
)
47 ifeq ($(shell uname
-m
), ppc
)
52 # if no host is identifed (no uname tool)
53 # we assume a AmigaOS build
58 #############################################
59 # now we find out the target OS for
60 # which we are going to compile YAM in case
61 # the caller didn't yet define OS himself
63 ifeq ($(HOST
), AmigaOS4
)
66 ifeq ($(HOST
), AmigaOS
)
69 ifeq ($(HOST
), MorphOS
)
75 ifeq ($(HOST
), Windows
)
79 # now we find out which CPU system aros will be used
80 ifeq ($(shell uname
-m
), powerpc
)
83 ifeq ($(shell uname
-m
), ppc
)
86 ifeq ($(shell uname
-m
), i386
)
89 ifeq ($(shell uname
-m
), i686
)
92 ifeq ($(shell uname
-m
), x86_64
)
95 ifeq ($(shell uname
-m
), arm
)
108 #############################################
109 # define common commands we use in this
110 # makefile. Please note that each of them
111 # might be overridden on the commandline.
117 RM
= rm -f
#delete force
118 RMDIR
= rm -rf
#delete force all
119 MKDIR
= mkdir
-p
#makedir force
120 CHMOD
= protect FLAGS
=rwed
132 # override some variables for non-native builds (cross-compiler)
133 ifneq ($(HOST
), AmigaOS
)
134 ifneq ($(HOST
), AmigaOS4
)
135 ifneq ($(HOST
), MorphOS
)
137 # when we end up here this is either a unix or Aros host
138 # so lets use unix kind of commands
151 ###########################################################################
152 # CPU and DEBUG can be defined outside, defaults to above
153 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
156 # OPTFLAGS are disabled by DEBUG normally!
158 # ignored warnings are:
159 # none - because we want to compile with -Wall all the time
162 TARGET
= $(BINDIR
)/flexcat
$(EXE
)
166 LOCALE
= $(PREFIX
)$(CDUP
)locale
167 TOOLS
= $(PREFIX
)tools
168 LIB
= $(PREFIX
)lib
/$(OS
)
175 # Common compiler/linker flags
176 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
#-Wunreachable-code
177 OPTFLAGS
= -O3
-fomit-frame-pointer
-fno-strict-aliasing
178 DEBUG
= -DDEBUG
-fno-omit-frame-pointer
#-O0
179 DEBUGSYM
= -g
-gstabs
180 CFLAGS
= -I.
-I.
/include $(CPU
) $(WARN
) $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
)
181 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
184 # different options per target OS
187 ##############################
190 # Compiler/link/strip commands
191 ifneq ($(HOST
), AmigaOS4
)
193 STRIP
= ppc-amigaos-strip
194 OBJDUMP
= ppc-amigaos-objdump
197 # Compiler/Linker flags
199 CPU
= -mcpu
=powerpc
-mstrict-align
200 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
-Wshadow
201 REDEFINE
= -DCoerceMethod
=ICoerceMethod
-DDoMethod
=IDoMethod \
202 -DDoSuperMethod
=IDoSuperMethod
-DDoSuperMethodA
=IDoSuperMethodA
203 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
204 $(REDEFINE
) -Wa
,-mregnames
-DAMIGA
205 LDFLAGS
+= -mcrt
=$(CRT
)
206 LDLIBS
+= -lauto
-lunix
210 SYSDEPOBJS
= locale.o \
217 ##############################
220 # Compiler/link/strip commands
221 ifneq ($(HOST
), AmigaOS
)
222 CC
= m68k-amigaos-gcc
223 STRIP
= m68k-amigaos-strip
224 OBJDUMP
= m68k-amigaos-objdump
227 # Compiler/Linker flags
228 CPU
= -m68020-60
-msoft-float
229 CFLAGS
+= -I.
/include/netinclude
-DNO_INLINE_STDARG
-D__amigaos3__
-DAMIGA
234 SYSDEPOBJS
= locale.o \
243 ##############################
246 # Compiler/link/strip commands
247 ifneq ($(HOST
), MorphOS
)
249 STRIP
= ppc-morphos-strip
250 OBJDUMP
= ppc-morphos-objdump
253 # Compiler/Linker flags
255 CFLAGS
+= -noixemul
-I.
/include/netinclude
-DAMIGA
257 LDLIBS
+= -lauto
-lcodesets
260 SYSDEPOBJS
= locale.o \
267 ifeq ($(OS
), aros-i386
)
269 ##############################
272 ifneq ($(HOST
), AROS
)
274 STRIP
= i386-aros-strip
275 OBJDUMP
= i386-aros-objdump
278 # Compiler/Linker flags
279 OPTFLAGS
= -O2
-fomit-frame-pointer
280 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
281 LDLIBS
+= -lamiga
-larossupport
-larosc
283 SYSDEPOBJS
= locale.o \
291 ifeq ($(OS
), aros-ppc
)
293 ##############################
296 ifneq ($(HOST
), AROS
)
298 STRIP
= ppc-aros-strip
299 OBJDUMP
= ppc-aros-objdump
302 # Compiler/Linker flags
303 OPTFLAGS
= -O2
-fomit-frame-pointer
304 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
305 LDLIBS
+= -lamiga
-larossupport
-larosc
307 SYSDEPOBJS
= locale.o \
315 ifeq ($(OS
), aros-x86_64
)
317 ##############################
320 ifneq ($(HOST
), AROS
)
322 STRIP
= x86_64-aros-strip
323 OBJDUMP
= x86_64-aros-objdump
326 # Compiler/Linker flags
327 OPTFLAGS
= -O2
-fomit-frame-pointer
328 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
329 LDLIBS
+= -lamiga
-larossupport
-larosc
331 SYSDEPOBJS
= locale.o \
339 ifeq ($(OS
), aros-arm
)
341 ##############################
344 ifneq ($(HOST
), AROS
)
346 STRIP
= arm-aros-strip
347 OBJDUMP
= arm-aros-objdump
350 # Compiler/Linker flags
351 OPTFLAGS
= -O2
-fomit-frame-pointer
352 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
353 LDLIBS
+= -lamiga
-larossupport
-larosc
355 SYSDEPOBJS
= locale.o \
363 ifeq ($(OS
), mingw32
)
365 ##############################
368 ifneq ($(HOST
), Windows
)
369 CC
= i586-mingw32msvc-gcc
370 STRIP
= i586-mingw32msvc-strip
371 OBJDUMP
= i586-mingw32msvc-objdump
374 # Compiler/Linker flags
376 OPTFLAGS
= -O2
-fomit-frame-pointer
379 SYSDEPOBJS
= locale_other.o \
387 ##############################
390 ifneq ($(HOST
), Linux
)
391 CC
= x86_64-linux-gnu-gcc
392 STRIP
= x86_64-linux-gnu-strip
393 OBJDUMP
= x86_64-linux-gnu-objdump
396 # Compiler/Linker flags
397 OPTFLAGS
= -O2
-fomit-frame-pointer
398 CFLAGS
+= -m32
-D_GNU_SOURCE
401 SYSDEPOBJS
= locale_other.o
414 ###########################################################################
415 # Here starts all stuff that is common for all target platforms and
418 CATFILES
= FlexCat_cat.h \
419 FlexCat_cat_other.h \
437 CATALOGS
= $(patsubst %.po
,%.catalog
,$(wildcard locale
/*.po
))
440 all: $(OBJDIR
) $(BINDIR
) $(DEPDIR
) $(TARGET
)
442 # for making a release we compile ALL target with no debug
454 make OS
=aros-i386
clean
455 make OS
=aros-i386 DEBUG
=
457 make OS
=aros-ppc
clean
458 make OS
=aros-ppc DEBUG
=
460 make OS
=aros-x86_64
clean
461 make OS
=aros-x86_64 DEBUG
=
466 make OS
=mingw32
clean
467 make OS
=mingw32 DEBUG
=
469 # make the object directories
474 # make the binary directory
479 # make the dependency directory
484 # for compiling single .c files
488 @
$(CC
) -MM
-MG
-o
$(DEPDIR
)/$(subst .c
,.d
,$<) $(CFLAGS
) $<
489 @
$(SED
) -i
's,^.*\.o:,$@:,g' $(DEPDIR
)/$(subst .c
,.d
,$<)
491 @
$(CC
) -MM
-MP
-MT
'$@' -MF
$(DEPDIR
)/$(subst .c
,.d
,$<) $(CFLAGS
) $<
493 @
$(CC
) $(CFLAGS
) -c
$< -o
$@
495 $(TARGET
): $(CATFILES
) $(addprefix $(OBJDIR
)/,$(OBJS
))
497 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(addprefix $(OBJDIR
)/,$(OBJS
)) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
499 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
502 locale.c
: locale
/FlexCat.pot sd
/NoAutoC_c.sd
504 @
$(FLEXCAT
) locale
/FlexCat.pot locale.c
=sd
/NoAutoC_c.sd
506 FlexCat_cat.h
: locale
/FlexCat.pot sd
/NoAutoC_h.sd
508 @
$(FLEXCAT
) locale
/FlexCat.pot FlexCat_cat.h
=sd
/NoAutoC_h.sd
510 locale_other.c
: locale
/FlexCat.pot sd
/Hardcode_c.sd
512 @
$(FLEXCAT
) locale
/FlexCat.pot locale_other.c
=sd
/Hardcode_c.sd
514 FlexCat_cat_other.h
: locale
/FlexCat.pot sd
/Hardcode_h.sd
516 @
$(FLEXCAT
) locale
/FlexCat.pot FlexCat_cat_other.h
=sd
/Hardcode_h.sd
518 locale
/%.catalog
: locale
/%.po
520 @
$(FLEXCAT
) POFILE
$< CATALOG
$@
524 catalogs
: $(CATALOGS
)
528 -$(RM
) $(addprefix $(OBJDIR
)/,$(OBJS
))
529 -$(RM
) $(BINDIR
)/$(FLEXCAT
)$(EXE
)
530 -$(RM
) ..
/doc
/*.guide
535 -$(RM
) FlexCat_cat_other.h
537 -$(RM
) locale_other.c
538 -$(RM
) locale
/*.catalog
543 $(MAKEINFO
) ..
/doc
/FlexCat_german.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_deutsch.guide
544 $(MAKEINFO
) ..
/doc
/FlexCat_english.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_english.guide
545 $(MAKEINFO
) ..
/doc
/FlexCat_spanish.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_espaƱol.guide
546 $(MAKEINFO
) ..
/doc
/FlexCat_swedish.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_svenska.guide
548 ## DEPENDENCY INCLUDE #################
550 -include $(OBJS
:%.o
=$(DEPDIR
)/%.d
)