Lines 363-376
Link Here
|
363 |
|
363 |
|
364 |
# compiler, linker and utilities |
364 |
# compiler, linker and utilities |
365 |
ifneq ($(TARGETOS),emscripten) |
365 |
ifneq ($(TARGETOS),emscripten) |
366 |
AR = @ar |
366 |
AR ?= @ar |
367 |
CC = @gcc |
367 |
CC ?= @gcc |
368 |
LD = @g++ |
368 |
CXX ?= @g++ |
|
|
369 |
LD = $(CXX) |
369 |
endif |
370 |
endif |
370 |
MD = -mkdir$(BUILD_EXE) |
371 |
MD = -mkdir$(BUILD_EXE) |
371 |
RM = @rm -f |
372 |
RM = @rm -f |
372 |
OBJDUMP = @objdump |
373 |
OBJDUMP = @objdump |
373 |
PYTHON = @python |
374 |
PYTHON ?= @python |
|
|
375 |
PKG_CONFIG ?= pkg-config |
374 |
|
376 |
|
375 |
#------------------------------------------------- |
377 |
#------------------------------------------------- |
376 |
# form the name of the executable |
378 |
# form the name of the executable |
Lines 523-529
Link Here
|
523 |
|
525 |
|
524 |
# CFLAGS is defined based on C or C++ targets |
526 |
# CFLAGS is defined based on C or C++ targets |
525 |
# (remember, expansion only happens when used, so doing it here is ok) |
527 |
# (remember, expansion only happens when used, so doing it here is ok) |
526 |
CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) $(INCPATH) |
528 |
CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS) $(INCPATH) |
527 |
|
529 |
|
528 |
# we compile C-only to C89 standard with GNU extensions |
530 |
# we compile C-only to C89 standard with GNU extensions |
529 |
# we compile C++ code to C++98 standard with GNU extensions |
531 |
# we compile C++ code to C++98 standard with GNU extensions |
Lines 535-543
Link Here
|
535 |
endif |
537 |
endif |
536 |
COBJFLAGS += -x objective-c++ |
538 |
COBJFLAGS += -x objective-c++ |
537 |
|
539 |
|
538 |
# this speeds it up a bit by piping between the preprocessor/compiler/assembler |
|
|
539 |
CCOMFLAGS += -pipe |
540 |
|
541 |
# add -g if we need symbols, and ensure we have frame pointers |
540 |
# add -g if we need symbols, and ensure we have frame pointers |
542 |
ifdef SYMBOLS |
541 |
ifdef SYMBOLS |
543 |
CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer -fno-optimize-sibling-calls |
542 |
CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer -fno-optimize-sibling-calls |
Lines 564-585
Link Here
|
564 |
CCOMFLAGS += -pg |
563 |
CCOMFLAGS += -pg |
565 |
endif |
564 |
endif |
566 |
|
565 |
|
567 |
# add the optimization flag |
|
|
568 |
CCOMFLAGS += -O$(OPTIMIZE) |
569 |
|
570 |
# add the error warning flag |
571 |
ifndef NOWERROR |
572 |
CCOMFLAGS += -Werror |
573 |
endif |
574 |
|
575 |
# if we are optimizing, include optimization options |
576 |
ifneq ($(OPTIMIZE),0) |
577 |
CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS) |
578 |
ifdef LTO |
579 |
CCOMFLAGS += -flto |
580 |
endif |
581 |
endif |
582 |
|
583 |
ifdef SSE2 |
566 |
ifdef SSE2 |
584 |
CCOMFLAGS += -msse2 |
567 |
CCOMFLAGS += -msse2 |
585 |
endif |
568 |
endif |
Lines 662-691
Link Here
|
662 |
# linking flags |
645 |
# linking flags |
663 |
#------------------------------------------------- |
646 |
#------------------------------------------------- |
664 |
|
647 |
|
665 |
# LDFLAGS are used generally; LDFLAGSEMULATOR are additional |
|
|
666 |
# flags only used when linking the core emulator |
667 |
LDFLAGS = |
668 |
ifneq ($(TARGETOS),macosx) |
669 |
ifneq ($(TARGETOS),os2) |
670 |
ifneq ($(TARGETOS),solaris) |
671 |
LDFLAGS = -Wl,--warn-common |
672 |
endif |
673 |
endif |
674 |
endif |
675 |
LDFLAGSEMULATOR = |
676 |
|
677 |
# add profiling information for the linker |
648 |
# add profiling information for the linker |
678 |
ifdef PROFILE |
649 |
ifdef PROFILE |
679 |
LDFLAGS += -pg |
650 |
LDFLAGS += -pg |
680 |
endif |
651 |
endif |
681 |
|
652 |
|
682 |
# strip symbols and other metadata in non-symbols and non profiling builds |
|
|
683 |
ifndef SYMBOLS |
684 |
ifneq ($(TARGETOS),macosx) |
685 |
LDFLAGS += -s |
686 |
endif |
687 |
endif |
688 |
|
689 |
ifneq ($(OPTIMIZE),0) |
653 |
ifneq ($(OPTIMIZE),0) |
690 |
ifdef LTO |
654 |
ifdef LTO |
691 |
LDFLAGS += -flto |
655 |
LDFLAGS += -flto |