############################################################################## # This packaging of ode assumes everything is run a directory in the ODE directory tree # Files that need to be available: # ../lib/libode.a # ../lib/libdrawstuff.a # ../include/ode # ../include/drawstuff # These can be put in your own directory or somewhere else, if you modify # INCPATH and LIBPATH below ############################################################################## .SUFFIXES: ############################################################################## # I copied user-settings and makefile.$(PLATFORM) to this directory. USER_SETTINGS=../config/user-settings include $(USER_SETTINGS) PLATFORM_MAKEFILE=../config/makefile.$(PLATFORM) include $(PLATFORM_MAKEFILE) ############################################################################## # Where are include files and libraries? ODE_LIB_NAME=ode DRAWSTUFF_LIB_NAME=drawstuff INCPATH=../include LIBPATH=../lib # library file names ODE_LIB=$(LIBPATH)/$(LIB_PREFIX)$(ODE_LIB_NAME)$(LIB_SUFFIX) DRAWSTUFF_LIB=$(LIBPATH)/$(LIB_PREFIX)$(DRAWSTUFF_LIB_NAME)$(LIB_SUFFIX) ############################################################################## # check some variables that were supposed to be defined ifneq ($(BUILD),debug) ifneq ($(BUILD),release) $(error the BUILD variable is not set properly) endif endif ifneq ($(PRECISION),SINGLE) ifneq ($(PRECISION),DOUBLE) $(error the PRECISION variable is not set properly) endif endif ############################################################################## # add some defines depending on the build mode ifeq ($(BUILD),release) DEFINES+=$(C_DEF)dNODEBUG endif ############################################################################## # List your program names here. CGA_SRC_CPP = \ unipod.cpp \ leg.cpp \ calf-lqr.cpp \ calf-id.cpp \ calf-manual.cpp \ calf.cpp CGA_SRC_C = #If you want .exe suffixes #CGA_EXE=$(CGA_SRC_CPP:%.cpp=%.exe) $(CGA_SRC_C:%.c=%.exe) CGA_EXE=$(CGA_SRC_CPP:%.cpp=%) $(CGA_SRC_C:%.c=%) CGA_O=$(CGA_SRC_CPP:%.cpp=%.o) $(CGA_SRC_C:%.c=%.o) ############################################################################## # rules # # NOTE: the '.c' files are pregenerated sources, and must be compiled with # -O1 optimization. that is why the rule for .c files is a bit different. # why should it be compiled with O1? it is numerical code that is generated # by fbuild. O1 optimization is used to preserve the operation orders that # were discovered by fbuild to be the fastest on that platform. believe it or # not, O2 makes this code run much slower for most compilers. all: cga @echo SUCCESS cga: $(CGA_EXE) clean: -$(DEL_CMD) $(CGA_EXE) $(CGA_O) %$(OBJ): %.c $(CC) $(C_FLAGS) $(C_INC)$(INCPATH) $(DEFINES) $(C_OPT)1 $(C_OUT)$@ $< %$(OBJ): %.cpp $(CC) $(C_FLAGS) $(C_INC)$(INCPATH) $(INC_OPCODE) $(DEFINES) $(C_OPT)$(OPT) $(C_OUT)$@ $< %: %$(OBJ) $(CC) $(C_EXEOUT)$@ $< $(ODE_LIB) $(DRAWSTUFF_LIB) $(RESOURCE_FILE) $(LINK_OPENGL) $(LINK_MATH) #If you want executable files to have .exe suffixes #%.exe: %$(OBJ) # $(CC) $(C_EXEOUT)$@ $< $(ODE_LIB) $(DRAWSTUFF_LIB) $(RESOURCE_FILE) $(LINK_OPENGL) $(LINK_MATH) # unix-gcc dependency making DEP_RULE=gcc -M $(C_INC)$(INCPATH) $(DEFINES) depend: $(DEP_RULE) $(CGA_SRC_CPP) $(CGA_SRC_C) > Makefile.deps include Makefile.deps