diff --git a/mymake.cpp b/mymake.cpp index 90b89b13..cae2ce19 100644 --- a/mymake.cpp +++ b/mymake.cpp @@ -1,5 +1,6 @@ // HyperRogue: alternative build system // This reads the file 'hyper.cpp' and compiles the cpp files it includes into separate object files, and then links them. +// Tested in Linux, should work in other systems with some changes. // Options: // -O2 -- optimize @@ -12,6 +13,7 @@ #include #include #include +#include using namespace std; @@ -46,9 +48,15 @@ string setdir = "../"; int system(string cmdline) { return system(cmdline.c_str()); } + +bool file_exists(string fname) { + return access(fname.c_str(), F_OK) != -1; + } int main(int argc, char **argv) { - system("make -f Makefile.loc language-data.cpp autohdr.h savepng-loc.o"); + for(string fname: {"Makefile.loc", "Makefile.simple", "Makefile"}) + if(file_exists(fname)) + system("make -f " + fname + " language-data.cpp autohdr.h savepng-loc.o"); for(int i=1; i