Thank you for the quick reply.
No, I am not cross compiling. I am wanting to use the same linker statement on my OS X machine as my Linux machine for deployment.
So far we use the same Makefile without any custom rules for OS X versus Linux. I would like to keep that going to gain the necessary support from the rest of the team to hopefully break out of the 2d box with the help of Ogre.
I use Eclipse CDT and do all manual Makefile projects. I will do my development on a game locally on my mac compiling, testing, etc.. Then push to our git server, then pull on the deployment machine and make then run to test.
I hope this helps, here is a Makefile from one of the projects:
Code: Select all
SRC_DIR=src/
OBJDIR=$(SRC_DIR)_nv_obj/
EXECUTABLE_NAME=game
COMPILE_VERSION_MAJOR = 0
COMPILE_VERSION_MINOR = 0
COMPILE_VERSION_REVISION = "undefined in makefile"
SDL_LIBRARIES = -lSDL_image -lSDL_mixer -lSDL -lSDL_ttf
SFML_LIBRARIES = -lsfml-system -lsfml-window -lsfml-network -lsfml-graphics -lsfml-audio
MEDIA_LIBRARIES = $(SFML_LIBRARIES)
LIBRARIES = $(MEDIA_LIBRARIES) -lcups -lserial -ldl -lm
OPENGL_FLAGS = -lGLU -lGL
MKDIR_P=mkdir -p
UNAME:=$(shell uname -s)
CPP_SOURCES:=$(shell find $(SRC_DIR) -type f -name '*.cpp')
CPP_OBJECTS=$(CPP_SOURCES:%.cpp=$(OBJDIR)%.o)
OBJECTS=$(CPP_OBJECTS)
CPP_ONLY_WARNING_FLAGS:= -Wsign-compare
WARNING_FLAGS_NO_WARNINGS:= -w
WARNING_FLAGS_ALL_WARNINGS:= -Wall
WARNING_FLAGS := $(CPP_ONLY_WARNING_FLAGS) -Wunreachable-code
# -O0 is the default Optimization flag
OPTIMIZE_FLAGS:= -O0
CPP_C = g++
CPP_LINK_FLAGS = -g -o
CPP_FLAGS =
SDL_CONFIG_DIR =
SDL_CONFIG = sdl-config --cflags
SDL_CONFIG_COMMAND = $(SDL_CONFIG_DIR)$(SDL_CONFIG)
#This is redundant, since $USER is set in the OS
# - But it will help remind me where it came from
USER := $(shell echo $(USER))
LINKER_EXTRAS =
COMPILER_EXTRAS =
#LIBRARIES = -lSDL_image -lSDL_mixer -lSDL -lSDL_ttf -lcups -lserial -ldl -lm
# Include Project specific Makefile include after the vars are set, bet before the rules are.
# This way, any variable can be overriden, and a custom rule will be declared first - thus,
# will be executed, while the default will be ignored.
include $(SRC_DIR)project.mk
VERSION_DEFINES:= -D VERSION_MAJOR=$(COMPILE_VERSION_MAJOR) -D VERSION_MINOR=$(COMPILE_VERSION_MINOR) -D VERSION_REVISION=$(COMPILE_VERSION_REVISION)
COMPILE_DATE:= `date +'%y.%m.%d'`
COMPILE_TIME:= `date +'%H:%M:%S'`
COMPILE_DATE_TIME_DEFINES:= -D COMPILE_DATE=\"$(COMPILE_DATE)\" -D COMPILE_TIME=\"$(COMPILE_TIME)\"
EXECUTABLE?= $(EXECUTABLE_NAME)
DEFINES := $(VERSION_DEFINES) $(COMPILE_DATE_TIME_DEFINES)
COMPILER_FLAGS = -c -g $(OPTIMIZE_FLAGS)
all: $(OBJECTS)
@echo -n 'Start executable linking.....'
@if $(CPP_C) $(OPENGL_FLAGS) $(CPP_LINK_FLAGS) $(EXECUTABLE) $(DEFINES) $(OBJECTS) $(LINKER_EXTRAS) $(LIBRARIES) ;\
then printf "SUCCESS!!\t\t\t";echo '';echo '-- Produced: '$(EXECUTABLE); echo '';\
else echo ''; echo "FAIL"; echo ''; exit 1;\
fi
$(OBJDIR)%.o : %.cpp
@$(MKDIR_P) $(@D)
@printf '%s' 'Compiling $*.cpp....'
@if g++ -Wno-deprecated $(DEFINES) $(COMPILER_FLAGS) $(COMPILER_EXTRAS) -I ./$(SRC_DIR) $< -o $@;\
then echo "Success";\
else echo "FAIL"; echo ''; exit 1;\
fi
.PHONY: clean done start nick v_colonFile scrub game camera
.IGNORE: clean
clean:
@echo '';echo '';echo '';
@echo "Starting the clean."
-rm $(OBJECTS) $(EXECUTABLE)
@echo "cleaned up."
@echo '';echo '';echo 'Files left behind:';
ls -R $(OBJDIR) | grep "\.o"
done:
@echo '';echo '';echo '';
start:
clear;
@echo '';echo '';echo '';
@echo 'Start.';
scrub: start clean all done
v_colonFile:
$(eval export DEFINES += -D VERBOSE_DEBUG_COLON_FILE)
echo_vars:
@echo "sdl-config: " $(SDL_CONFIG_COMMAND)
I am not a Makefile wizard, so I apologize for any confusion.
Thank you.