#======================================================================== # # NAME # # makefile # # DESCRIPTION # # Makefile for UNIX systems and Windows + Cygwin for compiling # and testing CRCDemo. # # Run from a command window by calling # # make # # To compile and test the program, type # # make test # # # LEGAL # # FFT Verision 2.1 - A Program for generating and checking CRC codes. # Copyright (C) 1999-2009 by Sean Erik O'Connor. All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # The author's address is artificer!AT!seanerikoconnor!DOT!freeservers!DOT!com # with the !DOT! replaced by . and the !AT! replaced by @ # #============================================================================= # Put this pseudo-target first so make without command line options executes it. all: makeAllExes platform: @echo $(HOSTNAME) #============================== Configuration ================================ # Get the name of the host and figure out if we are on a Windows/PC/Cygwin # platform. HOSTNAME := $(shell python -c "import platform; print platform.node()") ifeq ($(HOSTNAME), seanwinimac) PLATFORM = cygwin endif ifeq ($(HOSTNAME), peripatus) PLATFORM = cygwin endif ifeq ($(HOSTNAME), Peripatus) PLATFORM = cygwin endif # Default platform is Mac OS X ifndef PLATFORM PLATFORM = mac endif # Use the latest Mac OS X 10.5 (Leopard) SDK. ifeq ($(PLATFORM), mac) SDK = /Developer/SDKs/MacOSX10.5.sdk MAC_SDK = -isysroot ${SDK} endif # Cygwin include files and libraries. ifeq ($(PLATFORM), cygwin) CYGWIN_CPP_INC = -I "C:/cygwin/lib/gcc/i686-pc-mingw32/3.4.4/include/c++" CPP_LIBS = -L"C:/cygwin/lib" endif # GNU standard C and C++ compilers. ifeq ($(PLATFORM), mac) CPP= /Developer/usr/bin/g++-4.2 else CPP = g++ endif #============================== Compile and Link Flags ======================= # On the Mac, create a universal binary architectures for both ppc7400 and i386. ifeq ($(PLATFORM), mac) ARCH = -arch ppc -arch i386 endif # Debug and optimization switches. CPP_DEBUG_FLAGS = -O3 $(ARCH) #CPP_DEBUG_FLAGS = -g3 $(ARCH) # Turn on C++ exceptions, and collect the other flags. CPP_FLAGS = -fexceptions $(CPP_DEBUG_FLAGS) $(MAC_SDK) # Location of C++ and C Libraries. ifeq ($(PLATFORM), cygwin) endif # C++ and C include files. CPP_INC = -I /usr/include ${CYGWIN_CPP_INC} # Link flags. ifeq ($(PLATFORM), mac) LFLAGS = $(ARCH) -isysroot ${SDK} endif #============================== Root directories ============================= # Source file root directories. CPP_SRC_DIR = ../SourceCode # Object file root directories. CPP_OBJ_DIR = Bin # Executable file root directories. CPP_BIN_DIR = Bin #============================== List of Files ================================ # Object files. CPP_OBJ = $(CPP_OBJ_DIR)/FFT.o # Main program object files. CPP_OBJ_MAIN = $(CPP_OBJ_DIR)/testFFT.o # Main program executables. CPP_BIN_MAIN = $(CPP_BIN_DIR)/testFFT.exe #============================== Implicit Rules =============================== # Link all object files to executables. $(CPP_BIN_MAIN): $(CPP_OBJ_MAIN) $(CPP_OBJ) $(CPP) $(LFLAGS) $(CPP_OBJ_MAIN) $(CPP_OBJ) -o $(CPP_BIN_MAIN) $(CPP_LIBS) # C++ and C source file compilation to object files. $(CPP_BIN_DIR)/%.o : $(CPP_SRC_DIR)/%.cpp $(CPP) -c $(CPP_FLAGS) $(CPP_INC) $< -o $@ # List of all file.o : file.h dependencies. FFT.o: FFT.cpp fft.h testFFT.o: testFFT.cpp fft.h #============================== Targets ====================================== # Make all the executables. makeAllExes: $(CPP_BIN_MAIN) # Run tests for C++ Primpoly. test: $(CPP_BIN_MAIN) $(CPP_BIN_MAIN) fftIn.txt fftOut.txt # Remove all C and C++ object files and binaries. clean: rm $(CPP_OBJ) $(CPP_OBJ_MAIN) $(CPP_BIN_MAIN)