Added compilation flag for static generation (default: cgi)
This commit is contained in:
parent
f09c05fd1a
commit
336352a335
6
Makefile
6
Makefile
@ -3,6 +3,12 @@ BIN=cts
|
|||||||
|
|
||||||
all: main
|
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
|
main: main.o
|
||||||
gcc colors.o dbquery.o main.o -lsqlite3 -o $(BIN)
|
gcc colors.o dbquery.o main.o -lsqlite3 -o $(BIN)
|
||||||
|
|
||||||
|
@ -98,7 +98,11 @@ static void qresult(sqlite3_stmt * const sp, const char *c) {
|
|||||||
if (ISPLAYERNAME(c, i)) {
|
if (ISPLAYERNAME(c, i)) {
|
||||||
print_plname(field);
|
print_plname(field);
|
||||||
} else if (ISMAPNAME(c, i)) {
|
} else if (ISMAPNAME(c, i)) {
|
||||||
printf("<TD><a href='./%s.html'>%s</a></TD>", field, field);
|
#ifdef STATICGEN
|
||||||
|
printf("<TD><a href='./maps/%s.html'>%s</a></TD>", field, field);
|
||||||
|
#else
|
||||||
|
printf("<TD><a href='/cgi/cts?map=%s'>%s</a></TD>", field, field);
|
||||||
|
#endif
|
||||||
} else if (i == 2 && (*c == QMLEADERBOARD || *c == QOVERVIEW)) {
|
} else if (i == 2 && (*c == QMLEADERBOARD || *c == QOVERVIEW)) {
|
||||||
print_time(field);
|
print_time(field);
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,6 +34,10 @@ void templated(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
#ifdef STATICGEN
|
||||||
templated();
|
templated();
|
||||||
|
#else
|
||||||
|
html();
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user