diff options
author | FreeArtMan <dos21h@gmail.com> | 2017-05-20 13:43:49 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2017-05-20 13:43:49 +0100 |
commit | 126fa84b8591c3b285b7f598089451aa22447f10 (patch) | |
tree | 29eb78cd41870a1e4211e45b8e551a94b401ffe7 | |
parent | c03a145002445eaaa814e3f133c9a28f991bb860 (diff) | |
download | agni-126fa84b8591c3b285b7f598089451aa22447f10.tar.gz agni-126fa84b8591c3b285b7f598089451aa22447f10.zip |
Moved commands to seperate directory, moved external sources to seperate directory, updated Makefile with auto include and auto compile features
-rw-r--r-- | Makefile | 78 | ||||
-rw-r--r-- | cmd/cmd_botu.c (renamed from cmd_botu.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_botu.h (renamed from cmd_botu.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_cmd.c (renamed from cmd_cmd.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_cmd.h (renamed from cmd_cmd.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_cookie.c (renamed from cmd_cookie.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_cookie.h (renamed from cmd_cookie.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_date.c (renamed from cmd_date.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_date.h (renamed from cmd_date.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_fir.c (renamed from cmd_fir.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_fir.h (renamed from cmd_fir.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_fir1p.c (renamed from cmd_fir1p.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_fir1p.h (renamed from cmd_fir1p.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_loadavg.c (renamed from cmd_loadavg.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_loadavg.h (renamed from cmd_loadavg.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_ping.c (renamed from cmd_ping.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_ping.h (renamed from cmd_ping.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_rand.c (renamed from cmd_rand.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_rand.h (renamed from cmd_rand.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_rand_libc.c (renamed from cmd_rand_libc.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_rand_libc.h (renamed from cmd_rand_libc.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_rusage.c (renamed from cmd_rusage.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_rusage.h (renamed from cmd_rusage.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_sha1.c (renamed from cmd_sha1.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_sha1.h (renamed from cmd_sha1.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_sum.c | 0 | ||||
-rw-r--r-- | cmd/cmd_sum.h | 0 | ||||
-rw-r--r-- | cmd/cmd_uptime.c (renamed from cmd_uptime.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_uptime.h (renamed from cmd_uptime.h) | 0 | ||||
-rw-r--r-- | cmd/cmd_version.c (renamed from cmd_version.c) | 0 | ||||
-rw-r--r-- | cmd/cmd_version.h (renamed from cmd_version.h) | 0 | ||||
-rw-r--r-- | config_all_cmds.h | 18 | ||||
-rw-r--r-- | config_cmds.h | 15 | ||||
-rw-r--r-- | extlibs/sds.c (renamed from sds.c) | 0 | ||||
-rw-r--r-- | extlibs/sds.h (renamed from sds.h) | 0 | ||||
-rw-r--r-- | extlibs/sdsalloc.h (renamed from sdsalloc.h) | 0 | ||||
-rw-r--r-- | extlibs/sha1.c (renamed from sha1.c) | 0 | ||||
-rw-r--r-- | extlibs/sha1.h (renamed from sha1.h) | 0 |
38 files changed, 64 insertions, 47 deletions
@@ -1,40 +1,25 @@ PROJECT=agni CC=gcc CFLAGS= +SOURCES=$(wildcard *.c) +OBJECTS=$(SOURCES:.c=.o) +LDFLAGS=-lrt -lm +INCLUDE=-I./extlibs/ -I./ -make: version - $(CC) $(CFLAGS) buf.c -c - $(CC) $(CFLAGS) mmm.c -c - $(CC) $(CFLAGS) darray.c -c - $(CC) $(CFLAGS) mq_cmd.c -c - $(CC) $(CFLAGS) mq_ntf.c -c - $(CC) $(CFLAGS) tbl_qcmd.c -c - $(CC) $(CFLAGS) util.c -c - $(CC) $(CFLAGS) sock_conn.c -c - $(CC) $(CFLAGS) irc_parse.c -c - $(CC) $(CFLAGS) mmm.c -c - $(CC) $(CFLAGS) cmd_date.c -c - $(CC) $(CFLAGS) cmd_uptime.c -c - $(CC) $(CFLAGS) cmd_version.c -c - $(CC) $(CFLAGS) cmd_ping.c -c - $(CC) $(CFLAGS) cmd_loadavg.c -c - $(CC) $(CFLAGS) cmd_rusage.c -c - $(CC) $(CFLAGS) cmd_cmd.c -c - $(CC) $(CFLAGS) sha1.c -c - $(CC) $(CFLAGS) cmd_sha1.c -c - $(CC) $(CFLAGS) cmd_cookie.c -c - $(CC) $(CFLAGS) cmd_botu.c -c - $(CC) $(CFLAGS) cmd_fir1p.c -c - $(CC) $(CFLAGS) sds.c -c - $(CC) $(CFLAGS) cmd_rand.c -c - $(CC) $(CFLAGS) cmd_rand_libc.c -c - $(CC) $(CFLAGS) cmd_fir.c -c - $(CC) $(CFLAGS) tbl_qcmd.o mq_cmd.o mq_ntf.o buf.o mmm.o darray.o util.o sock_conn.o \ - irc_parse.o mmm.c cmd_date.o cmd_uptime.o cmd_version.o cmd_ping.o cmd_loadavg.o \ - cmd_rusage.o cmd_cmd.o sha1.o cmd_sha1.o cmd_cookie.o cmd_botu.o cmd_fir1p.o sds.o \ - cmd_rand.o cmd_rand_libc.o cmd_fir.o agni.c \ - -o $(PROJECT) -std=c11 -lrt -lm +all: createcmd createextlib $(OBJECTS) $(PROJECT) +$(PROJECT): version $(SOURCES) agni.c + $(CC) $(OBJECTS) $(CFLAGS) $(LDFLAGS) -std=c11 -o $(PROJECT) + +#make: version +# $(CC) $(CFLAGS) agni.c \ +# -o $(PROJECT) -std=c11 -lrt -lm + +%.o: %.c + @echo $@ + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $(subst .c,.o,$<) + +#autogenerate version from git commit and date when it was compiled version: #could have bug if commit message have somethign bad in it rm -f version.h @@ -44,8 +29,35 @@ version: echo "#define VERSION_COMMIT \""`git log -1 --oneline`"\"">>version.h echo "#endif">>version.h +#get all C files in cmd firectory and compile all of them +CMD_SOURCES=$(wildcard cmd/*.c) +CMD_HEADERS=$(wildcard cmd/*.h) +#output header with all includes to commands +CMD_INC_HEADER=config_all_cmds.h +#cmd object files +CMD_OBJECTS=$(CMD_SOURCES:.c=.o) +#add commands objects to all objects +OBJECTS+=$(CMD_OBJECTS) +createcmd: headerscmd $(CMD_OBJECTS) + #echo $(CMD_SOURCES) + #echo $(CMD_OBJECTS) + +#generate header files with all commands in directory, to include all cmd header files in single include +headerscmd: + rm -f $(CMD_INC_HEADER) + echo "#ifndef __CONFIG_CMD_HEADERS_H">>$(CMD_INC_HEADER) + echo "#define __CONFIG_CMD_HEADERS_H">>$(CMD_INC_HEADER) + for header in $(CMD_HEADERS); do echo -e "#include \"$$header\"">>$(CMD_INC_HEADER); done + echo "#endif">>$(CMD_INC_HEADER) + +EXTLIB_SOURCES=$(wildcard extlibs/*.c) +EXTLIB_OBJECTS=$(EXTLIB_SOURCES:.c=.o) +OBJECTS+=$(EXTLIB_OBJECTS) +createextlib: $(EXTLIB_OBJECTS) + #asd + leak: valgrind --leak-check=full --track-origins=yes --log-file=log.txt ./$(PROJECT) clean: - rm -f agni *.o
\ No newline at end of file + rm -f agni *.o cmd/*.o
\ No newline at end of file diff --git a/cmd_botu.c b/cmd/cmd_botu.c index f284ba9..f284ba9 100644 --- a/cmd_botu.c +++ b/cmd/cmd_botu.c diff --git a/cmd_botu.h b/cmd/cmd_botu.h index 2c06230..2c06230 100644 --- a/cmd_botu.h +++ b/cmd/cmd_botu.h diff --git a/cmd_cmd.c b/cmd/cmd_cmd.c index e893687..e893687 100644 --- a/cmd_cmd.c +++ b/cmd/cmd_cmd.c diff --git a/cmd_cmd.h b/cmd/cmd_cmd.h index 2670abd..2670abd 100644 --- a/cmd_cmd.h +++ b/cmd/cmd_cmd.h diff --git a/cmd_cookie.c b/cmd/cmd_cookie.c index 8071e10..8071e10 100644 --- a/cmd_cookie.c +++ b/cmd/cmd_cookie.c diff --git a/cmd_cookie.h b/cmd/cmd_cookie.h index 62a4779..62a4779 100644 --- a/cmd_cookie.h +++ b/cmd/cmd_cookie.h diff --git a/cmd_date.c b/cmd/cmd_date.c index ac44bd5..ac44bd5 100644 --- a/cmd_date.c +++ b/cmd/cmd_date.c diff --git a/cmd_date.h b/cmd/cmd_date.h index 0e1c9c5..0e1c9c5 100644 --- a/cmd_date.h +++ b/cmd/cmd_date.h diff --git a/cmd_fir.c b/cmd/cmd_fir.c index 95e0b53..95e0b53 100644 --- a/cmd_fir.c +++ b/cmd/cmd_fir.c diff --git a/cmd_fir.h b/cmd/cmd_fir.h index 46815a7..46815a7 100644 --- a/cmd_fir.h +++ b/cmd/cmd_fir.h diff --git a/cmd_fir1p.c b/cmd/cmd_fir1p.c index b011719..b011719 100644 --- a/cmd_fir1p.c +++ b/cmd/cmd_fir1p.c diff --git a/cmd_fir1p.h b/cmd/cmd_fir1p.h index 1586ef2..1586ef2 100644 --- a/cmd_fir1p.h +++ b/cmd/cmd_fir1p.h diff --git a/cmd_loadavg.c b/cmd/cmd_loadavg.c index a9a4b28..a9a4b28 100644 --- a/cmd_loadavg.c +++ b/cmd/cmd_loadavg.c diff --git a/cmd_loadavg.h b/cmd/cmd_loadavg.h index d3bd9c2..d3bd9c2 100644 --- a/cmd_loadavg.h +++ b/cmd/cmd_loadavg.h diff --git a/cmd_ping.c b/cmd/cmd_ping.c index a8e3c59..a8e3c59 100644 --- a/cmd_ping.c +++ b/cmd/cmd_ping.c diff --git a/cmd_ping.h b/cmd/cmd_ping.h index fef18c6..fef18c6 100644 --- a/cmd_ping.h +++ b/cmd/cmd_ping.h diff --git a/cmd_rand.c b/cmd/cmd_rand.c index 58f2efe..58f2efe 100644 --- a/cmd_rand.c +++ b/cmd/cmd_rand.c diff --git a/cmd_rand.h b/cmd/cmd_rand.h index 14f5c7e..14f5c7e 100644 --- a/cmd_rand.h +++ b/cmd/cmd_rand.h diff --git a/cmd_rand_libc.c b/cmd/cmd_rand_libc.c index d72bc45..d72bc45 100644 --- a/cmd_rand_libc.c +++ b/cmd/cmd_rand_libc.c diff --git a/cmd_rand_libc.h b/cmd/cmd_rand_libc.h index 42fb1a1..42fb1a1 100644 --- a/cmd_rand_libc.h +++ b/cmd/cmd_rand_libc.h diff --git a/cmd_rusage.c b/cmd/cmd_rusage.c index 3dc5d21..3dc5d21 100644 --- a/cmd_rusage.c +++ b/cmd/cmd_rusage.c diff --git a/cmd_rusage.h b/cmd/cmd_rusage.h index 5e35317..5e35317 100644 --- a/cmd_rusage.h +++ b/cmd/cmd_rusage.h diff --git a/cmd_sha1.c b/cmd/cmd_sha1.c index 4472ed1..4472ed1 100644 --- a/cmd_sha1.c +++ b/cmd/cmd_sha1.c diff --git a/cmd_sha1.h b/cmd/cmd_sha1.h index 69a7bc8..69a7bc8 100644 --- a/cmd_sha1.h +++ b/cmd/cmd_sha1.h diff --git a/cmd/cmd_sum.c b/cmd/cmd_sum.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cmd/cmd_sum.c diff --git a/cmd/cmd_sum.h b/cmd/cmd_sum.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cmd/cmd_sum.h diff --git a/cmd_uptime.c b/cmd/cmd_uptime.c index 6a9c963..6a9c963 100644 --- a/cmd_uptime.c +++ b/cmd/cmd_uptime.c diff --git a/cmd_uptime.h b/cmd/cmd_uptime.h index 3906cd2..3906cd2 100644 --- a/cmd_uptime.h +++ b/cmd/cmd_uptime.h diff --git a/cmd_version.c b/cmd/cmd_version.c index d919c60..d919c60 100644 --- a/cmd_version.c +++ b/cmd/cmd_version.c diff --git a/cmd_version.h b/cmd/cmd_version.h index 23cd639..23cd639 100644 --- a/cmd_version.h +++ b/cmd/cmd_version.h diff --git a/config_all_cmds.h b/config_all_cmds.h new file mode 100644 index 0000000..8847d7d --- /dev/null +++ b/config_all_cmds.h @@ -0,0 +1,18 @@ +#ifndef __CONFIG_CMD_HEADERS_H +#define __CONFIG_CMD_HEADERS_H +#include "cmd/cmd_rand.h" +#include "cmd/cmd_cmd.h" +#include "cmd/cmd_rusage.h" +#include "cmd/cmd_version.h" +#include "cmd/cmd_cookie.h" +#include "cmd/cmd_sha1.h" +#include "cmd/cmd_fir1p.h" +#include "cmd/cmd_loadavg.h" +#include "cmd/cmd_uptime.h" +#include "cmd/cmd_rand_libc.h" +#include "cmd/cmd_botu.h" +#include "cmd/cmd_ping.h" +#include "cmd/cmd_fir.h" +#include "cmd/cmd_sum.h" +#include "cmd/cmd_date.h" +#endif diff --git a/config_cmds.h b/config_cmds.h index c206ca6..9adfe7a 100644 --- a/config_cmds.h +++ b/config_cmds.h @@ -9,20 +9,7 @@ typedef struct single_cmd_def //list all include files with commands -#include "cmd_date.h" -#include "cmd_uptime.h" -#include "cmd_version.h" -#include "cmd_ping.h" -#include "cmd_loadavg.h" -#include "cmd_rusage.h" -#include "cmd_cmd.h" -#include "cmd_sha1.h" -#include "cmd_cookie.h" -#include "cmd_botu.h" -#include "cmd_fir1p.h" -#include "cmd_rand.h" -#include "cmd_rand_libc.h" -#include "cmd_fir.h" +#include "config_all_cmds.h" //some commands have aliases for compat with some developerslv bots //nothing else comaptible will be added, as its not about "standarts" diff --git a/sdsalloc.h b/extlibs/sdsalloc.h index f43023c..f43023c 100644 --- a/sdsalloc.h +++ b/extlibs/sdsalloc.h |