diff --git a/Makefile b/Makefile index c86f686..3f21dfe 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,12 @@ BIN=cts all: main +staticgen: colors.o src/dbquery.c + echo "\nCompiling executable as static page generator\n" + gcc -c src/dbquery.c $(CFLAGS) -DSTATICGEN + gcc -c src/main.c $(CFLAGS) -DSTATICGEN + gcc colors.o dbquery.o main.o -lsqlite3 -o $(BIN) + main: main.o gcc colors.o dbquery.o main.o -lsqlite3 -o $(BIN) diff --git a/src/dbquery.c b/src/dbquery.c index 7705e03..7b331ec 100644 --- a/src/dbquery.c +++ b/src/dbquery.c @@ -98,7 +98,11 @@ static void qresult(sqlite3_stmt * const sp, const char *c) { if (ISPLAYERNAME(c, i)) { print_plname(field); } else if (ISMAPNAME(c, i)) { - printf("%s", field, field); +#ifdef STATICGEN + printf("%s", field, field); +#else + printf("%s", field, field); +#endif } else if (i == 2 && (*c == QMLEADERBOARD || *c == QOVERVIEW)) { print_time(field); } else { diff --git a/src/main.c b/src/main.c index 0f64fd4..b2130ee 100644 --- a/src/main.c +++ b/src/main.c @@ -34,6 +34,10 @@ void templated(void) { } int main(void) { +#ifdef STATICGEN templated(); +#else + html(); +#endif return 0; }