1 #/***************************************************************************
5 # Copyright (C) 1993-1999 by Jochen Wiedmann and Marcin Orlowski
6 # Copyright (C) 2002-2015 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
133 # override some variables for non-native builds (cross-compiler)
134 ifneq ($(HOST
), AmigaOS
)
135 ifneq ($(HOST
), AmigaOS4
)
136 ifneq ($(HOST
), MorphOS
)
138 # when we end up here this is either a unix or Aros host
139 # so lets use unix kind of commands
152 ###########################################################################
153 # CPU and DEBUG can be defined outside, defaults to above
154 # using e.g. "make DEBUG= CPU=-mcpu=603e" produces optimized non-debug
157 # OPTFLAGS are disabled by DEBUG normally!
159 # ignored warnings are:
160 # none - because we want to compile with -Wall all the time
163 TARGET
= $(BINDIR
)/flexcat
$(EXE
)
167 LOCALE
= $(PREFIX
)$(CDUP
)locale
168 TOOLS
= $(PREFIX
)tools
169 LIB
= $(PREFIX
)lib
/$(OS
)
176 # Common compiler/linker flags
177 WARN
= -W
-Wall
-Wwrite-strings
-Wpointer-arith
-Wsign-compare
#-Wunreachable-code
178 OPTFLAGS
= -O3
-fomit-frame-pointer
-fno-strict-aliasing
179 DEBUG
= -DDEBUG
-fno-omit-frame-pointer
#-O0
180 DEBUGSYM
= -g
-gstabs
181 CFLAGS
= -I.
-I.
/include $(CPU
) $(WARN
) $(OPTFLAGS
) $(DEBUG
) $(DEBUGSYM
)
182 LDFLAGS
= $(CPU
) $(DEBUGSYM
)
185 # different options per target OS
188 ##############################
191 # Compiler/link/strip commands
192 ifneq ($(HOST
), AmigaOS4
)
194 STRIP
= ppc-amigaos-strip
195 OBJDUMP
= ppc-amigaos-objdump
198 # Compiler/Linker flags
200 CPU
= -mcpu
=powerpc
-mstrict-align
201 WARN
+= -Wdeclaration-after-statement
-Wdisabled-optimization
-Wshadow
202 REDEFINE
= -DCoerceMethod
=ICoerceMethod
-DDoMethod
=IDoMethod \
203 -DDoSuperMethod
=IDoSuperMethod
-DDoSuperMethodA
=IDoSuperMethodA
204 CFLAGS
+= -mcrt
=$(CRT
) -D__USE_INLINE__
-D__NEW_TIMEVAL_DEFINITION_USED__ \
205 $(REDEFINE
) -Wa
,-mregnames
-DAMIGA
206 LDFLAGS
+= -mcrt
=$(CRT
)
207 LDLIBS
+= -lauto
-lunix
211 SYSDEPOBJS
= locale.o \
218 ##############################
221 # Compiler/link/strip commands
222 ifneq ($(HOST
), AmigaOS
)
223 CC
= m68k-amigaos-gcc
224 STRIP
= m68k-amigaos-strip
225 OBJDUMP
= m68k-amigaos-objdump
228 # Compiler/Linker flags
229 CPU
= -m68020-60
-msoft-float
230 CFLAGS
+= -I.
/include/netinclude
-DNO_INLINE_STDARG
-D__amigaos3__
-DAMIGA
235 SYSDEPOBJS
= locale.o \
244 ##############################
247 # Compiler/link/strip commands
248 ifneq ($(HOST
), MorphOS
)
250 STRIP
= ppc-morphos-strip
251 OBJDUMP
= ppc-morphos-objdump
254 # Compiler/Linker flags
256 CFLAGS
+= -noixemul
-I.
/include/netinclude
-DAMIGA
258 LDLIBS
+= -lauto
-lcodesets
261 SYSDEPOBJS
= locale.o \
268 ifeq ($(OS
), aros-i386
)
270 ##############################
273 ifneq ($(HOST
), AROS
)
275 STRIP
= i386-aros-strip
276 OBJDUMP
= i386-aros-objdump
279 # Compiler/Linker flags
280 OPTFLAGS
= -O3
-fomit-frame-pointer
281 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
282 LDLIBS
+= -lamiga
-larossupport
-larosc
284 SYSDEPOBJS
= locale.o \
292 ifeq ($(OS
), aros-ppc
)
294 ##############################
297 ifneq ($(HOST
), AROS
)
299 STRIP
= ppc-aros-strip
300 OBJDUMP
= ppc-aros-objdump
303 # Compiler/Linker flags
304 OPTFLAGS
= -O3
-fomit-frame-pointer
305 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
306 LDLIBS
+= -lamiga
-larossupport
-larosc
308 SYSDEPOBJS
= locale.o \
316 ifeq ($(OS
), aros-x86_64
)
318 ##############################
321 ifneq ($(HOST
), AROS
)
323 STRIP
= x86_64-aros-strip
324 OBJDUMP
= x86_64-aros-objdump
327 # Compiler/Linker flags
328 OPTFLAGS
= -O3
-fomit-frame-pointer
329 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
330 LDLIBS
+= -lamiga
-larossupport
-larosc
332 SYSDEPOBJS
= locale.o \
340 ifeq ($(OS
), aros-arm
)
342 ##############################
345 ifneq ($(HOST
), AROS
)
347 STRIP
= arm-aros-strip
348 OBJDUMP
= arm-aros-objdump
351 # Compiler/Linker flags
352 OPTFLAGS
= -O3
-fomit-frame-pointer
353 CFLAGS
+= -Wno-pointer-sign
-DNO_INLINE_STDARG
-D__BSD_VISIBLE
=1 -DAMIGA
354 LDLIBS
+= -lamiga
-larossupport
-larosc
356 SYSDEPOBJS
= locale.o \
364 ifeq ($(OS
), mingw32
)
366 ##############################
369 ifneq ($(HOST
), Windows
)
370 CC
= i686-w64-mingw32-gcc
371 STRIP
= i686-w64-mingw32-strip
372 OBJDUMP
= i686-w64-mingw32-objdump
375 # Compiler/Linker flags
377 OPTFLAGS
= -O3
-fomit-frame-pointer
378 CFLAGS
+= -I.
/include/mingw32
382 SYSDEPOBJS
= locale_other.o \
390 ##############################
393 ifneq ($(HOST
), Linux
)
394 CC
= x86_64-linux-gnu-gcc
395 STRIP
= x86_64-linux-gnu-strip
396 OBJDUMP
= x86_64-linux-gnu-objdump
399 # Compiler/Linker flags
400 OPTFLAGS
= -O3
-fomit-frame-pointer
401 CFLAGS
+= -D_GNU_SOURCE
404 SYSDEPOBJS
= locale_other.o
417 ###########################################################################
418 # Here starts all stuff that is common for all target platforms and
421 CATFILES
= FlexCat_cat.h \
422 FlexCat_cat_other.h \
440 CATALOGS
= $(patsubst %.po
,%.catalog
,$(wildcard locale
/*.po
))
443 all: $(OBJDIR
) $(BINDIR
) $(DEPDIR
) $(TARGET
)
445 # for making a release we compile ALL target with no debug
457 make OS
=aros-i386
clean
458 make OS
=aros-i386 DEBUG
=
460 make OS
=aros-ppc
clean
461 make OS
=aros-ppc DEBUG
=
463 make OS
=aros-x86_64
clean
464 make OS
=aros-x86_64 DEBUG
=
469 make OS
=mingw32
clean
470 make OS
=mingw32 DEBUG
=
472 # make the object directories
477 # make the binary directory
482 # make the dependency directory
487 # for compiling single .c files
491 @
$(CC
) -MM
-MG
-o
$(DEPDIR
)/$(subst .c
,.d
,$<) $(CFLAGS
) $<
492 @
$(SED
) -i
's,^.*\.o:,$@:,g' $(DEPDIR
)/$(subst .c
,.d
,$<)
494 @
$(CC
) -MM
-MP
-MT
'$@' -MF
$(DEPDIR
)/$(subst .c
,.d
,$<) $(CFLAGS
) $<
496 @
$(CC
) $(CFLAGS
) -c
$< -o
$@
498 $(TARGET
): $(CATFILES
) $(addprefix $(OBJDIR
)/,$(OBJS
))
500 @
$(CC
) $(LDFLAGS
) -o
$@.debug
$(addprefix $(OBJDIR
)/,$(OBJS
)) $(LDLIBS
) -Wl
,--cref
,-M
,-Map
=$@.map
502 @
$(STRIP
) --preserve-dates
-R.comment
-R.sdata2
-S
-o
$@
$@.debug
505 locale.c
: locale
/FlexCat.pot sd
/NoAutoC_c.sd
507 @
$(FLEXCAT
) locale
/FlexCat.pot locale.c
=sd
/NoAutoC_c.sd
509 FlexCat_cat.h
: locale
/FlexCat.pot sd
/NoAutoC_h.sd
511 @
$(FLEXCAT
) locale
/FlexCat.pot FlexCat_cat.h
=sd
/NoAutoC_h.sd
513 locale_other.c
: locale
/FlexCat.pot sd
/Hardcode_c.sd
515 @
$(FLEXCAT
) locale
/FlexCat.pot locale_other.c
=sd
/Hardcode_c.sd
517 FlexCat_cat_other.h
: locale
/FlexCat.pot sd
/Hardcode_h.sd
519 @
$(FLEXCAT
) locale
/FlexCat.pot FlexCat_cat_other.h
=sd
/Hardcode_h.sd
521 locale
/%.catalog
: locale
/%.po
523 @
$(FLEXCAT
) REVISION
$(shell git rev-list
--all --count
$<) POFILE
$< CATALOG
$@
525 ## TRANSIFEX ##########################
536 catalogs
: $(CATALOGS
)
540 -$(RM
) $(addprefix $(OBJDIR
)/,$(OBJS
))
541 -$(RM
) $(BINDIR
)/$(FLEXCAT
)$(EXE
)
542 -$(RM
) ..
/doc
/*.guide
547 -$(RM
) FlexCat_cat_other.h
549 -$(RM
) locale_other.c
550 -$(RM
) locale
/*.catalog
555 $(MAKEINFO
) ..
/doc
/FlexCat_german.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_deutsch.guide
556 $(MAKEINFO
) ..
/doc
/FlexCat_english.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_english.guide
557 $(MAKEINFO
) ..
/doc
/FlexCat_spanish.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_espaƱol.guide
558 $(MAKEINFO
) ..
/doc
/FlexCat_swedish.texinfo
--amiga-39
--fill-column
76 --output ..
/doc
/FlexCat_svenska.guide
560 ## DEPENDENCY INCLUDE #################
562 -include $(OBJS
:%.o
=$(DEPDIR
)/%.d
)