# This make file was been written with the EXPRESS requirement that it # exists in the "CsMapDev/EpsgToAsc" directory and that directory is the current # working directory of the make executable which is processing it; with the # original intent being that this makefile would be invoked by a higher level # make file which executes something like the following: # # $(MAKE) -e -C./CsMapEpsgToAsc -f EpsgToAsc.mak # # Having predefined the $(VERSION), $(CONFIGURATION), and $(PROCESSOR) make # variables. For testing and debugging of this make file, default definitions # which worked for the original developer are provided below. # Some basic defines for the this make file procedure. PRJ_NAME = EpsgToAsc TRG_BASE = EpsgToAsc TRG_SRC_BASE = EpsgToAsc # # Set the following default values so that this makefile can be used, tested, # debugged at this level # VERSION ?= 47 CONFIGURATION ?= Linux PROCESSOR ?= x64 # For this project, we create a library of functions. These definitions give # this library a name. EPSG2ASC_LIB_BASE ?= EpsgToAsc EPSG2ASC_LIB_EXT = .a EPSG2ASC_LIB_NAME = $(EPSG2ASC_LIB_BASE)$(EPSG2ASC_LIB_EXT) # # The following definitions are instituted to facilitate building and # testing multiple versions of the Library. The object here is to have # distinct directories for the various flavors of binary object, library, and # executable files generated from a single set of source files. The variables # referenced by these definitions are normally expected to be passed from a # parent makefile. The default values set here represent rather generic values # which can be useful when in maintenance/development mode with respect # to the EpsgToAsc utility module itself. # OUT_DIR ?= ../bin$(VERSION)/$(CONFIGURATION) LIB_DIR ?= ../lib$(VERSION)/$(CONFIGURATION) INT_DIR ?= ../obj$(VERSION)/$(PRJ_NAME)/$(CONFIGURATION) CSMAP_LIB_NAME ?= CsMap # # The following options are chosen to be rather generic; something that # should work in any UNIX/Linux type environment. More sophisticated # specifications can/should be coded in the parent make file. The extra # include specification is required to gain access to CS-MAP library includes. # C_FLG ?= -c -w -O2 -I../Include -I../../Include CXX_FLG ?= -c -w -O2 -I../Include -I../../Include # # Adjust the above defines for the various processors, currently only # two: x86 (32 bits) and x64 (64 bit x86) # ifeq ($(PROCESSOR),x64) OUT_DIR := $(OUT_DIR)64 INT_DIR := $(INT_DIR)64 LIB_DIR := $(LIB_DIR)64 C_FLG += -m64 -fPIC CXX_FLG += -m64 -fPIC endif ifeq ($(PROCESSOR),x86) OUT_DIR := $(OUT_DIR)32 INT_DIR := $(INT_DIR)32 LIB_DIR := $(LIB_DIR)32 C_FLG += -m32 CXX_FLG += -m32 endif # # Define the targets of this make file. This being the first target, this is # what gets made if no target is specified on the the commane line. # ALL : $(OUT_DIR)/$(TRG_BASE) $(LIB_DIR)/$(EPSG2ASC_LIB_NAME) # Rule to compile the main function separately, it does not go in the library $(INT_DIR)/$(TRG_SRC_BASE).o : Source/$(TRG_SRC_BASE).cpp $(CC) $(C_FLG) -I./Include -o $(INT_DIR)/$(TRG_SRC_BASE).o $< # Rule to create the executable named $(TRG_BASE) in the appropriate $(OUT_DIR) # Is the -I option necessary??? $(OUT_DIR)/$(TRG_BASE) : $(INT_DIR)/$(TRG_SRC_BASE).o $(LIB_DIR)/$(EPSG2ASC_LIB_NAME) $(LIB_DIR)/$(CSMAP_LIB_NAME).a gcc -I../Include -o $(OUT_DIR)/$(TRG_BASE) $(INT_DIR)/$(TRG_SRC_BASE).o \ $(LIB_DIR)/$(EPSG2ASC_LIB_NAME) \ $(LIB_DIR)/$(CSMAP_LIB_NAME).a \ -lm -lc -lgcc -lstdc++ # Rule to make the $(EPSG2ASC_LIB_NAME) library $(LIB_DIR)/$(EPSG2ASC_LIB_NAME) : $(LIB_DIR)/$(CSMAP_LIB_NAME).a $(MAKE) -e -C ./Source -f EpsgToAscLib.mak # Rule to make the CS_MAP library if it has been changed. $(LIB_DIR)/$(CSMAP_LIB_NAME).a : $(MAKE) -e -C ../Source -f Library.mak .PHONY : clean clean : rm -f $(INT_DIR)/*.o rm -f $(LIB_DIR)/$(EPSG2ASC_LIB_NAME) rm -f $(OUT_DIR)/$(TRG_BASE) rebuild: clean $(OUT_DIR)/$(TRG_BASE) $(LIB$(DICTIONARIES) # # The following rules create the directories in which the results are to be # written if they don't already exist. The -p option on the 'mkdir' # command creates all intermediate directories as well; and also inhibits # an error condition of they already exist. # $(INT_DIR)/$(TRG_BASE).o : | $(INT_DIR) $(OUT_DIR)/$(TRG_BASE) : | $(OUT_DIR) # $(INT_DIR) : mkdir -p $(INT_DIR) $(OUT_DIR) : mkdir -p $(OUT_DIR)