Add changes to Makefile

Add -fPIC to linker flags (additional to compiler flags).
This is sometimes necessary as chronologicaldot reported in the forum: 
http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=52708
Also gcc manual says this about the -shared flag: 
"For predictable results, you must also specify the same set of options used for compilation (-fpic, -fPIC, or model suboptions) when you specify this linker option."
Add TODO for this about sharedlib_osx as I can't test that.

Add documentation when "make clean" is needed. So far we only have a single set of .o files written in the same folder.
So this has to be called basically on all changes.

Use CPPFLAGS instead of CFLAGS, CXXFLAGS in a few places for options which should be used for all files.

Add CFLAGS and CXXFLAGS for dependency files (not 100% certain about those, just seems to make more sense to me)



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6207 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2021-04-17 13:57:33 +00:00
parent bfaffe1171
commit 451134322d

View File

@ -11,6 +11,10 @@ VERSION_RELEASE = 0
# This will compile Irrlicht, create a static lib (libIrrlicht.a), and copy it # This will compile Irrlicht, create a static lib (libIrrlicht.a), and copy it
# into the subdirectory lib/Linux. That's all. # into the subdirectory lib/Linux. That's all.
# #
# If you switch any settings (like debug/release/static/shared) then first run:
#
# make clean
#
# If you want Irrlicht to be compiled as shared lib (libIrrlicht.so.versionnumber), then run: # If you want Irrlicht to be compiled as shared lib (libIrrlicht.so.versionnumber), then run:
# #
# make sharedlib # make sharedlib
@ -74,17 +78,18 @@ CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti
#CXXFLAGS += -std=gnu++11 -U__STRICT_ANSI__ #CXXFLAGS += -std=gnu++11 -U__STRICT_ANSI__
ifndef NDEBUG ifndef NDEBUG
CXXFLAGS += -g -D_DEBUG CPPFLAGS += -g -D_DEBUG
else else
CXXFLAGS += -O3 CPPFLAGS += -O3
endif endif
ifdef PROFILE ifdef PROFILE
CXXFLAGS += -pg CPPFLAGS += -pg
endif endif
CFLAGS := -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0 CFLAGS := -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
sharedlib sharedlib_osx: CXXFLAGS += -fPIC sharedlib sharedlib_osx: CPPFLAGS += -fPIC
sharedlib sharedlib_osx: CFLAGS += -fPIC # TODO: also necessary on sharedlib_osx?
sharedlib: LDFLAGS += -fPIC
#multilib handling #multilib handling
ifeq ($(HOSTTYPE), x86_64) ifeq ($(HOSTTYPE), x86_64)
@ -173,11 +178,11 @@ TAGS:
# Create dependency files for automatic recompilation # Create dependency files for automatic recompilation
%.d:%.cpp %.d:%.cpp
$(CXX) $(CPPFLAGS) -MM -MF $@ $< $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MM -MF $@ $<
# Create dependency files for automatic recompilation # Create dependency files for automatic recompilation
%.d:%.c %.d:%.c
$(CC) $(CPPFLAGS) -MM -MF $@ $< $(CC) $(CPPFLAGS) $(CFLAGS) -MM -MF $@ $<
# Create object files from objective-c code # Create object files from objective-c code
%.o:%.mm %.o:%.mm