diff --git a/makefile b/makefile index dfc98a8..80616f3 100644 --- a/makefile +++ b/makefile @@ -1,91 +1,44 @@ -#Macros that are corss platform +#A list of the ciphers that can be used +#This is used to create the libraries and for cpp files in the test version +CIPHERS = Caesar Playfair Vigenere Atbash Morse Autokey +#Other usefull macros LIBFLAGS = -shared -std=c++11 -O3 -fPIC -Wall EXEFLAGS = -std=c++11 -O3 TESTFLAGS = -std=c++11 -DTEST_VERSION DEBUGFLAGS = $(TESTFLAGS) -g LIBDIR = ./lib -CIPHERS = Caesar Playfair Vigenere Atbash Morse Autokey LIBFILES = $(patsubst %,SourceFiles/%.cpp,$(CIPHERS)) -#For Linux -allLinux: libsLinux CipherStream -testLinux: libsLinux CiphersTest -debugLinux: CiphersDBG -libsLinux: directory $(patsubst %, $(LIBDIR)/lib%.a,$(CIPHERS)) -LINUXLIBS = $(patsubst %, -l%,$(CIPHERS)) - -#For Windows -allWindows: libsWindows CipherStream.exe -testWindows: libsWindows CiphersTest.exe -debugWindows: CipherDBG.exe -#Keeping the old one for now, until I can test it to make sure it works -#WindowsLibs: libCaesar.lib libPlayfair.lib libVigenere.lib libAtbash.lib -#WINDOWSLIBS = -llibCaesar -llibPlayfair -llibVigenere -llibAtbash -libsWindows: $(patsubst %, lib%.lib,$(CIPHERS)) -WINDOWSLIBS = $(patsubst %, -llib%,$(CIPHERS)) - +#Different portions to compile +#Using the simplest make command compiles all +all: libs CipherStream +test: libs CiphersTest +debug: CiphersDBG +libs: directory $(patsubst %, $(LIBDIR)/lib%.a,$(CIPHERS)) +LIBS = $(patsubst %, -l%,$(CIPHERS)) directory: mkdir -p $(LIBDIR) -#Linux - #Building Libraries $(LIBDIR)/lib%.a: SourceFiles/%.cpp $(CXX) $(LIBFLAGS) -o $@ $< #Building Executables CipherStream: main.cpp helperFunctions.hpp - $(CXX) $(EXEFLAGS) -o $@ main.cpp -L $(LIBDIR) $(LINUXLIBS) + $(CXX) $(EXEFLAGS) -o $@ main.cpp -L $(LIBDIR) $(LIBS) CiphersTest: main.cpp testMain.hpp - $(CXX) $(TESTFLAGS) -o $@ $< -L $(LIBDIR) $(LINUXLIBS) + $(CXX) $(TESTFLAGS) -o $@ $< -L $(LIBDIR) $(LIBS) CiphersDBG: main.cpp testMain.hpp $(LIBFILES) $(CXX) $(DEBUGFLAGS) -o $@ $< $(LIBFILES) - -#Windows -#Building Libraries -libCaesar.lib: SourceFiles/Caesar.cpp - g++ $(LIBFLAGS) -o $@ $< - -libPlayfair.lib: SourceFiles/Playfair.cpp - g++ $(LIBFLAGS) -o $@ $< - -libVigenere.lib: SourceFiles/Vigenere.cpp - g++ $(LIBFLAGS) -o $@ $< - -libAtbash.lib: SourceFiles/Atbash.cpp - g++ $(LIBFLAGS) -o $@ $< - -libAutokey.lib: SourceFiles/Autokey.cpp libVigenere.lib - g++ $(LIBFLAGS) -o $@ $< -L./ -llibVigenere - -libMorse.lib: SourceFiles/Morse.cpp - g++ $(LIBFLAGS) -o $@ $< - -#Building Executables -CipherStream.exe: main.cpp helperFunctions.hpp - g++ $(EXEFLAGS) -o $@ main.cpp -L./ $(WINDOWSLIBS) - -CiphersTest.exe: main.cpp testMain.hpp - g++ $(TESTFLAGS) -o $@ $< -L./ $(WINDOWSLIBS) - -CiphersDBG.exe: main.cpp testMain.hpp $(LIBFILES) - g++ $(DEBUGFLAGS) -o $@ $< $(LIBFILES) - - #Cleaning Shop -.PHONY: cleanLinux -.PHONY: cleanWindows +.PHONY: clean #Linux Remove -cleanLinux: +clean: rm -f lib/*.a Cipher* - -#Windows Remove -cleanWindows: - rm -f *.lib Cipher*.exe