diff --git a/Makefile b/Makefile index 8461f27..3edb6bc 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,29 @@ VERSION := v2.00 -CFLAGS := -O2 -pipe -Wall -DVERSION='"$(VERSION)"' +CFLAGS := -O2 -pipe -Wall -Iinclude -DVERSION='"$(VERSION)"' LDFLAGS := -ldl -rdynamic -HLSWMASTER_SRC := configfile.o event.o gamelist.o hlswmaster.o logging.o \ - netpkt.o plugin.o plugin_helper.o scanner.o server.o - -PLUGINS := $(wildcard p_*.c) +OBJS := configfile.o event.o gamelist.o logging.o netpkt.o plugin.o \ + plugin_helper.o scanner.o server.o -all: hlswmaster masterquery $(PLUGINS:.c=.so) +all: hlswmaster masterquery + make -C plugins all -hlswmaster: $(HLSWMASTER_SRC) +hlswmaster: $(OBJS) hlswmaster.o $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ masterquery: masterquery.o - $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ + $(CC) $(CFLAGS) $^ -o $@ %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ -%.so: %_sh.o - $(LD) -shared -o $@ $< - -%_sh.o: %.c - $(CC) $(CFLAGS) -fPIC -c $< -o $@ - %.d: %.c $(CC) $(CFLAGS) -MM -c $< -o $@ clean: - rm -f hlswmaster masterquery *.so *.d *.o *.log + rm -f hlswmaster masterquery *.d *.o *.log + make -C plugins clean DEPS := $(wildcard *.c) -include $(DEPS:.c=.d) diff --git a/hlswmaster.conf b/hlswmaster.conf index 33fff46..6def817 100644 --- a/hlswmaster.conf +++ b/hlswmaster.conf @@ -14,15 +14,15 @@ ## master answers with this source IP #master_src 0.0.0.0:7140 -#plugin_dir . -plugin p_d3engine.so -plugin p_gamespy1.so -plugin p_gamespy2.so -plugin p_halflife.so -plugin p_hlswproxy.so -plugin p_q3engine.so -plugin p_quake2.so -plugin p_ut2k4.so +plugin_dir plugins +plugin d3engine.so +plugin gamespy1.so +plugin gamespy2.so +plugin halflife.so +plugin hlswproxy.so +plugin q3engine.so +plugin quake2.so +plugin ut2k4.so ## logging #logfile hlswmaster.log diff --git a/configfile.h b/include/configfile.h similarity index 100% rename from configfile.h rename to include/configfile.h diff --git a/event.h b/include/event.h similarity index 100% rename from event.h rename to include/event.h diff --git a/gamelist.h b/include/gamelist.h similarity index 100% rename from gamelist.h rename to include/gamelist.h diff --git a/list.h b/include/list.h similarity index 100% rename from list.h rename to include/list.h diff --git a/logging.h b/include/logging.h similarity index 100% rename from logging.h rename to include/logging.h diff --git a/netpkt.h b/include/netpkt.h similarity index 100% rename from netpkt.h rename to include/netpkt.h diff --git a/plugin.h b/include/plugin.h similarity index 100% rename from plugin.h rename to include/plugin.h diff --git a/plugin_helper.h b/include/plugin_helper.h similarity index 100% rename from plugin_helper.h rename to include/plugin_helper.h diff --git a/scanner.h b/include/scanner.h similarity index 100% rename from scanner.h rename to include/scanner.h diff --git a/server.h b/include/server.h similarity index 100% rename from server.h rename to include/server.h diff --git a/plugins/.gitignore b/plugins/.gitignore new file mode 100644 index 0000000..fd9c310 --- /dev/null +++ b/plugins/.gitignore @@ -0,0 +1,3 @@ +*.o +*.so +*.d diff --git a/plugins/Makefile b/plugins/Makefile new file mode 100644 index 0000000..8a1ffd4 --- /dev/null +++ b/plugins/Makefile @@ -0,0 +1,22 @@ +PLUGINS := $(wildcard *.c) +CFLAGS := -O2 -pipe -Wall -I../include + +all: $(PLUGINS:.c=.so) + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +%.so: %_sh.o + $(LD) -shared -o $@ $< + +%_sh.o: %.c + $(CC) $(CFLAGS) -fPIC -c $< -o $@ + +%.d: %.c + $(CC) $(CFLAGS) -MM -c $< -o $@ + +clean: + rm -f *.so *.d *.o + +DEPS := $(wildcard *.c) +-include $(DEPS:.c=.d) diff --git a/p_d3engine.c b/plugins/d3engine.c similarity index 100% rename from p_d3engine.c rename to plugins/d3engine.c diff --git a/p_gamespy1.c b/plugins/gamespy1.c similarity index 100% rename from p_gamespy1.c rename to plugins/gamespy1.c diff --git a/p_gamespy2.c b/plugins/gamespy2.c similarity index 100% rename from p_gamespy2.c rename to plugins/gamespy2.c diff --git a/p_halflife.c b/plugins/halflife.c similarity index 100% rename from p_halflife.c rename to plugins/halflife.c diff --git a/p_hlswproxy.c b/plugins/hlswproxy.c similarity index 100% rename from p_hlswproxy.c rename to plugins/hlswproxy.c diff --git a/p_q3engine.c b/plugins/q3engine.c similarity index 100% rename from p_q3engine.c rename to plugins/q3engine.c diff --git a/p_quake2.c b/plugins/quake2.c similarity index 100% rename from p_quake2.c rename to plugins/quake2.c diff --git a/p_ut2k4.c b/plugins/ut2k4.c similarity index 100% rename from p_ut2k4.c rename to plugins/ut2k4.c