password_manager/build.cpp
2024-07-19 01:51:47 +02:00

70 lines
1.0 KiB
C++

#define NO_Werror
#include "build.hpp"
bool build = false;
bool clear = false;
bool run = false;
bool opt = false;
int main(int argc, char const *argv[])
{
if (rebuild_my_self(__FILE__, argc, argv))
return 1;
for (int i = 1; i < argc; ++i)
{
if (!std::strcmp(argv[i], "opt"))
{
opt_flags = "-O3";
opt = true;
}
if (!std::strcmp(argv[i], "build"))
build = true;
if (!std::strcmp(argv[i], "run"))
run = true;
if (!std::strcmp(argv[i], "cla"))
{
clear_all_build();
clear = true;
}
}
if (clear && !build)
{
return 0;
}
std::filesystem::create_directory(OBJ_DIR);
if (!opt)
{
int res = compile_src_dir();
switch (res)
{
case 1:
compile_obj_dir();
break;
case -1:
return 0;
}
if (!std::filesystem::exists(BUILD_FILE))
compile_obj_dir();
}
else
{
build_as_one();
}
if (run)
{
command = {"./" + BUILD_FILE.string(), "Pot", "20", "1080"};
nob_cmd_run_sync(command);
}
return 0;
}