# Windows did not have basename, so i took my extension grabber program from edabit and modified it # to get the basename of a file without an extension. Basename is now installed in the windows # System32 folder to be used ANYWHERE on the computer. # # make has a default recipe that uses the target & prequisite to build files # % is used as a substitution for any variable. $< is used to substitute the prerequisite # %.exe matches the default target rule which is what make is being asked to build. # the variable can be accessed using $@ # : seperates the target from target prerequisite(s) %.cpp represents what is needed to build the exe # "g++ $< -o $(basename $@)/$@" is the recipe used by Make to compile the exe # the default build rule %.exe will follow this example: make lame.exe will generate the recipe # g++ lame.exe -o lame/lame.exe OUTPUT_FOLDER = $(basename $@) .PHONY : clean # all: ; $(foreach v, $(.VARIABLE), $(info $(v) = $($(v)))) # info : # $(foreach v, $(.VARIABLE), $(info $(v) = $($(v)))) # -gdwarf-2 for debug information for intel VTune Profiler. %.exe : $(p)\%.cpp g++ $< -g3 -gdwarf-4 -o $(p)\$(basename $@)\$@ clean : # del $(basename $(f))\$(f) '$(ProgramFiles)/Git/usr/bin/rm.exe' -rf $(p)\$(basename $(f))\$(f) # cp was not working in powershell, it has to be copy. line endings matter for some programs # to remove ambiguity from the copy command, quotes are necessary to put around the destination path to specify it was a directory and not a file url2file.exe : url2file.c url2file/libpng16.dll url2file/libcurl.dll g++ $< -L $(ow)/lib/ -I $(ow)/include/ -lcurl -o $(basename $@)/$@ libharuEXMP.exe : libharuEXMP.cpp libharuEXMP/libpng16.dll libharuEXMP/libhpdf.dll g++ $< -L $(ow)/lib/ -I $(ow)/include/ -lhpdf -o $(basename $@)/$@ # to read more about make variables - chapter 10.5.3, automatic variables in GNU Make manual %.dll : copy $(ow)\bin\$(@F) "$(@D)\" cleanPDFtest.exe : cleanPDFtest.cpp cleanPDFtest/libpng16.dll cleanPDFtest/libhpdf.dll g++ $< -L $(ow)/lib/ -I $(ow)/include/ -lhpdf -o $(basename $@)/$@ BasicImageAndText.exe pdfHummusTest1.exe PauseAndContinue.exe : g++ -g -I C:/Users/bad-p/Downloads/PDFHummus-build/PDFWriter/include $(@:.exe=.cpp) -L C:/Users/bad-p/Downloads/PDFHummus-build/PDFWriter/objs -lall -o $(basename $@)/$@ # also make the object file for debugging reasons # g++ -I C:/Users/bad-p/Downloads/PDFHummus-build/PDFWriter/include -c $(@:.exe=.cpp) -o $(basename $@)/$(@:.exe=.o)