LDFLAGS :=
LIBS :=
-.PHONY: all clean format replace ./Mandshurica ./Module
+.PHONY: all clean format replace ./Mandshurica ./Module ./Tool
-all: ./Mandshurica ./Module
+all: ./Mandshurica ./Module ./Tool
./Mandshurica::
$(MAKE) -C $@ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"
./Module::
$(MAKE) -C $@ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"
+./Tool::
+ $(MAKE) -C $@ CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"
+
format:
clang-format -i $(wildcard Module/*.c Module/*.h Mandshurica/*.c Mandshurica/*.h)
clean:
$(MAKE) -C ./Mandshurica clean
$(MAKE) -C ./Module clean
+ $(MAKE) -C ./Tool clean
int nloaded_mods = 0;
int nerror_mods = 0;
+char* loaded_config = NULL;
+
void mandshurica_add_mod(void* lib) {
struct mandshurica_mod** old_mods = loaded_mods;
int i;
struct mandshurica_config config = {.mandshurica_log = mandshurica_log, .mandshurica_get_param = mandshurica_get_param, .mandshurica_parse_template = mandshurica_parse_template, .mandshurica_load = mandshurica_load, .mandshurica_sha512 = mandshurica_sha512};
int mandshurica_load_config(const char* path) {
+ if(loaded_config != NULL) free(loaded_config);
+ loaded_config = mandshurica_strdup(path);
if(server_root == NULL) {
server_root = mandshurica_strdup(PREFIX);
}
if(argv[i] == NULL) {
fprintf(stderr, "%s: %s: needs argument\n", argv[0], argv[i - 1]);
return 1;
- } else {
+ } else if(!loaded_config) {
int ret = mandshurica_load_config(argv[i]);
if(ret != 0) return ret;
loaded_config = true;
--- /dev/null
+# $Id$
+
+EXTRA_CFLAGS =
+EXTRA_LDFLAGS =
+EXTRA_LIBS =
+
+.PHONY: all clean
+
+all: ./html-manage
+
+./html-manage: ./html-manage.o ./util.o ./db.o
+ $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) -o $@ $^ $(LIBS) $(EXTRA_LIBS)
+
+./html-manage.o: ./html-manage.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
+./util.o: ../Mandshurica/util.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
+./db.o: ../Mandshurica/db.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f ./html-manage *.o
--- /dev/null
+/* $Id$ */
+/* --- START LICENSE --- */
+/* --- END LICENSE --- */
+
+#include <stdio.h>
+
+int main(int argc, char** argv){
+ if(argc < 2){
+ printf("invalid usage\n");
+ }
+ printf("%s\n", argv[1]);
+}