From b6ca5637ae862d1ac015577af36217718c39439a Mon Sep 17 00:00:00 2001 From: Tom Balzer Date: Sun, 10 Mar 2019 23:07:29 -0500 Subject: [PATCH] Switched to autotools --- .gitignore | 15 ++++++++ Makefile | 11 ------ Makefile.am | 2 + configure.ac | 9 +++++ src/Makefile.am | 3 ++ src/{common => }/PROTOCOL_DESIGN | 0 src/dumb-client/main.c | 66 -------------------------------- src/{common => }/guile_helpers.c | 9 +++-- src/{common => }/protocol.c | 0 src/{common => }/socketio.c | 0 src/{tomc/main.c => tomc.c} | 4 +- src/{tomd/main.c => tomd.c} | 6 +-- src/tomd/init.c | 25 ------------ src/tomd/manifest.c | 23 ----------- 14 files changed, 39 insertions(+), 134 deletions(-) delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 configure.ac create mode 100644 src/Makefile.am rename src/{common => }/PROTOCOL_DESIGN (100%) delete mode 100644 src/dumb-client/main.c rename src/{common => }/guile_helpers.c (98%) rename src/{common => }/protocol.c (100%) rename src/{common => }/socketio.c (100%) rename src/{tomc/main.c => tomc.c} (98%) rename src/{tomd/main.c => tomd.c} (98%) delete mode 100644 src/tomd/init.c delete mode 100644 src/tomd/manifest.c diff --git a/.gitignore b/.gitignore index 01d7463..7daaf60 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,18 @@ /client /tomc /tests/find_lines/a.out +/src/tomc +*.o +/src/tomd +Makefile +*.in +/aclocal.m4 +/compile +*.log +/config.status +/configure +/depcomp +/install-sh +/missing +.deps +autom4te.cache diff --git a/Makefile b/Makefile deleted file mode 100644 index 3affb96..0000000 --- a/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# TODO > Use GNU automake tools - -all:tomd tomc - -tomd:./src/tomd/main.c ./src/common/guile_helpers.c - gcc -static -o tomd \ - -I/usr/local/include/guile/2.2 \ - ./src/tomd/main.c ./src/common/guile_helpers.c - -tomc:./src/tomc/main.c ./src/common/socketio.c - gcc -o tomc ./src/tomc/main.c ./src/common/socketio.c -static diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..bc39d20 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS=src +# dis_doc_DATA = README, CONTRIBUTING, COPYING diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..779cb8a --- /dev/null +++ b/configure.ac @@ -0,0 +1,9 @@ +AC_INIT([tomd], [0.0.1], [tbalzer2012@gmail.com]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AC_PROG_CC +dnl AC_CONFIG_HEADERS([]) +AC_CONFIG_FILES([ + Makefile + src/Makefile +]) +AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..6bea2c6 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,3 @@ +bin_PROGRAMS=tomc tomd +tomc_SOURCES=tomc.c guile_helpers.c socketio.c +tomd_SOURCES=tomd.c guile_helpers.c socketio.c diff --git a/src/common/PROTOCOL_DESIGN b/src/PROTOCOL_DESIGN similarity index 100% rename from src/common/PROTOCOL_DESIGN rename to src/PROTOCOL_DESIGN diff --git a/src/dumb-client/main.c b/src/dumb-client/main.c deleted file mode 100644 index 9a61a23..0000000 --- a/src/dumb-client/main.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2018 Thomas Balzer */ - -/* This file is part of tomd. */ - -/* tomd is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ - -/* tomd is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ - -/* You should have received a copy of the GNU General Public License */ -/* along with tomd. If not, see . */ - -#include -#include -#include -#include -#include - -static int sfd; - -static void init(void) -{ - /* init socket connection */ - sfd = - socket(PF_LOCAL, - SOCK_STREAM, - 0); - if(sfd < 0){ - perror("socket"); - exit(EXIT_FAILURE); - } - - struct sockaddr_un addr; - addr.sun_family = AF_LOCAL; - sprintf(addr.sun_path, "/run/user/1000/tomd/socket"); - - if(connect(sfd, (struct sockaddr *) &addr, SUN_LEN(&addr)) != 0){ - perror("connect"); - exit(EXIT_FAILURE); - } -} - -#define HALLO "hallo there from dumb-client" - -void write_hallo(void) -{ - printf("writing hallo\n"); - ssize_t wrote = - write(sfd, HALLO, sizeof HALLO); - printf("wrote %d bytes.\n", wrote); -} - -int main(int argc, char **argv) -{ - printf("dumb client startup.\n"); - - init(); - write_hallo(); - - return EXIT_SUCCESS; -} diff --git a/src/common/guile_helpers.c b/src/guile_helpers.c similarity index 98% rename from src/common/guile_helpers.c rename to src/guile_helpers.c index 416a790..b68a769 100644 --- a/src/common/guile_helpers.c +++ b/src/guile_helpers.c @@ -15,17 +15,18 @@ /* You should have received a copy of the GNU General Public License */ /* along with tomd. If not, see . */ -#include #include #include #include +#include #include -#include "../../include/job.h" -#include "../../include/macros.h" +#include "../include/job.h" +#include "../include/macros.h" #ifdef GUILE_CAPABLE -#include "../../include/scm_interface.h" +#include +#include "../include/scm_interface.h" #endif #define MANIFEST_LOC "/.config/tomd/init/manifest.scm" diff --git a/src/common/protocol.c b/src/protocol.c similarity index 100% rename from src/common/protocol.c rename to src/protocol.c diff --git a/src/common/socketio.c b/src/socketio.c similarity index 100% rename from src/common/socketio.c rename to src/socketio.c diff --git a/src/tomc/main.c b/src/tomc.c similarity index 98% rename from src/tomc/main.c rename to src/tomc.c index 46f44a7..7c2044d 100644 --- a/src/tomc/main.c +++ b/src/tomc.c @@ -21,8 +21,8 @@ #include #include -#include "../../include/macros.h" -#include "../../include/manifest.h" +#include "../include/macros.h" +#include "../include/manifest.h" static int sfd; diff --git a/src/tomd/main.c b/src/tomd.c similarity index 98% rename from src/tomd/main.c rename to src/tomd.c index f4bf04b..0467a23 100644 --- a/src/tomd/main.c +++ b/src/tomd.c @@ -27,9 +27,9 @@ #include #include -#include "../../include/macros.h" -#include "../../include/manifest.h" -#include "../../include/job.h" +#include "../include/macros.h" +#include "../include/manifest.h" +#include "../include/job.h" static void header(void) { diff --git a/src/tomd/init.c b/src/tomd/init.c deleted file mode 100644 index 9e12975..0000000 --- a/src/tomd/init.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2018 Thomas Balzer */ - -/* This file is part of tomd. */ - -/* tomd is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ - -/* tomd is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ - -/* You should have received a copy of the GNU General Public License */ -/* along with tomd. If not, see . */ - -#define DEFAULT_INIT_DIR "~/.config/tomd/init - -static void run_init(void) -{ - /* load all recognized files in the init directory */ - /* check for a manifest (defines run order) */ - /* loop through the manifest */ -} diff --git a/src/tomd/manifest.c b/src/tomd/manifest.c deleted file mode 100644 index 2c6c2f0..0000000 --- a/src/tomd/manifest.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 2018 Thomas Balzer */ - -/* This file is part of tomd. */ - -/* tomd is free software: you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation, either version 3 of the License, or */ -/* (at your option) any later version. */ - -/* tomd is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ -/* GNU General Public License for more details. */ - -/* You should have received a copy of the GNU General Public License */ -/* along with tomd. If not, see . */ - - - -static void load_manifest(const char const *manifest_path) -{ - -} -- 2.20.1