From af0fdadc884fb6ac79febd9b4a23257fa271d961 Mon Sep 17 00:00:00 2001 From: louib Date: Fri, 10 Jan 2020 17:37:02 -0500 Subject: [PATCH] Creating subdirs for third-party modules. Since these modules are considered third-party (at least for now) and we also don't want to apply formatting to them. Also removed the `AUTOMAKE_OPTIONS` from `Makefile.am` since it would appear the `AM_INIT_AUTOMAKE` is actually defining the automake options. --- .github/workflows/ci.yml | 4 +--- .github/workflows/ci_ubuntu-16.04.yml | 4 +--- .gitignore | 15 +++------------ Makefile.am | 8 ++++---- configure.ac | 2 +- src/Makefile.am | 2 +- src/{ => isaac_rand}/isaac_rand.c | 0 src/{ => isaac_rand}/isaac_rand.h | 0 src/{ => isaac_rand}/isaac_standard.h | 0 src/{ => mt19937ar-cok}/mt19937ar-cok.c | 0 src/{ => mt19937ar-cok}/mt19937ar-cok.h | 0 src/prng.c | 4 ++-- 12 files changed, 13 insertions(+), 26 deletions(-) rename src/{ => isaac_rand}/isaac_rand.c (100%) rename src/{ => isaac_rand}/isaac_rand.h (100%) rename src/{ => isaac_rand}/isaac_standard.h (100%) rename src/{ => mt19937ar-cok}/mt19937ar-cok.c (100%) rename src/{ => mt19937ar-cok}/mt19937ar-cok.h (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69903c2..d45258a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,4 @@ jobs: run: make # Changing the path should no longer be necessary when clang-format6 is installed. - name: verifying code style - # TODO use check-format when all the code has been formatted. - # run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format - run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && clang-format -i -style=file src/context.h src/device.h src/device.c src/logging.c src/logging.h src/nwipe.c src/nwipe.h src/options.c src/options.h src/gui.h src/gui.c src/version.h src/version.c src/method.h src/method.c src/pass.c src/pass.h src/prng.c src/prng.h && git diff-index --quiet HEAD + run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format diff --git a/.github/workflows/ci_ubuntu-16.04.yml b/.github/workflows/ci_ubuntu-16.04.yml index aaf6974..87043af 100644 --- a/.github/workflows/ci_ubuntu-16.04.yml +++ b/.github/workflows/ci_ubuntu-16.04.yml @@ -21,6 +21,4 @@ jobs: run: make # Changing the path should no longer be necessary when clang-format6 is installed. - name: verifying code style - # TODO use check-format when all the code has been formatted. - # run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format - run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && clang-format -i -style=file src/context.h src/device.h src/device.c src/logging.c src/logging.h src/nwipe.c src/nwipe.h src/options.c src/options.h src/gui.h src/gui.c src/version.h src/version.c src/method.h src/method.c src/pass.c src/pass.h src/prng.c src/prng.h && git diff-index --quiet HEAD + run: export PATH=$PATH:/usr/lib/llvm-5.0/bin && make check-format diff --git a/.gitignore b/.gitignore index fc3b4c3..7c440c5 100644 --- a/.gitignore +++ b/.gitignore @@ -13,19 +13,10 @@ install-sh man/Makefile man/Makefile.in missing -src/.deps/ +src/**/.deps/ +src/**/.dirstamp +*.o src/Makefile src/Makefile.in src/nwipe -src/nwipe-device.o -src/nwipe-gui.o -src/nwipe-isaac_rand.o -src/nwipe-logging.o -src/nwipe-method.o -src/nwipe-mt19937ar-cok.o -src/nwipe-nwipe.o -src/nwipe-options.o -src/nwipe-pass.o -src/nwipe-prng.o -src/nwipe-version.o stamp-h1 diff --git a/Makefile.am b/Makefile.am index 938dffa..7380656 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,9 @@ -AUTOMAKE_OPTIONS = foreign SUBDIRS = src man -NWIPESOURCES = src/*.c src/*.h +# The set of files to be formatted. +FORMATSOURCES = src/*.c src/*.h format: - clang-format -i -style=file $(NWIPESOURCES) + clang-format -i -style=file $(FORMATSOURCES) check-format: - clang-format -i -style=file $(NWIPESOURCES) && git diff-index --quiet HEAD + clang-format -i -style=file $(FORMATSOURCES) && git diff-index --quiet HEAD diff --git a/configure.ac b/configure.ac index 82582eb..24bf522 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.64]) AC_INIT([nwipe], [0.26], [git@brumit.nl]) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE(foreign subdir-objects) AC_OUTPUT(Makefile src/Makefile man/Makefile) AC_CONFIG_SRCDIR([src/nwipe.c]) AC_CONFIG_HEADERS([config.h]) diff --git a/src/Makefile.am b/src/Makefile.am index a5f5740..2609bdd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,6 +6,6 @@ AM_LDFLAGS = # this lists the binaries to produce, the (non-PHONY, binary) targets in # the previous manual Makefile bin_PROGRAMS = nwipe -nwipe_SOURCES = context.h isaac_rand.c logging.h options.h prng.h nwipe.c gui.c isaac_rand.h method.h pass.c device.c gui.h isaac_standard.h mt19937ar-cok.c nwipe.h mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c version.h +nwipe_SOURCES = context.h isaac_rand/isaac_rand.c logging.h options.h prng.h nwipe.c gui.c isaac_rand/isaac_rand.h method.h pass.c device.c gui.h isaac_rand/isaac_standard.h mt19937ar-cok/mt19937ar-cok.c nwipe.h mt19937ar-cok/mt19937ar-cok.h pass.h device.h logging.c method.c options.c prng.c version.c version.h nwipe_CFLAGS = $(PARTED_CFLAGS) nwipe_LDADD = $(PARTED_LIBS) diff --git a/src/isaac_rand.c b/src/isaac_rand/isaac_rand.c similarity index 100% rename from src/isaac_rand.c rename to src/isaac_rand/isaac_rand.c diff --git a/src/isaac_rand.h b/src/isaac_rand/isaac_rand.h similarity index 100% rename from src/isaac_rand.h rename to src/isaac_rand/isaac_rand.h diff --git a/src/isaac_standard.h b/src/isaac_rand/isaac_standard.h similarity index 100% rename from src/isaac_standard.h rename to src/isaac_rand/isaac_standard.h diff --git a/src/mt19937ar-cok.c b/src/mt19937ar-cok/mt19937ar-cok.c similarity index 100% rename from src/mt19937ar-cok.c rename to src/mt19937ar-cok/mt19937ar-cok.c diff --git a/src/mt19937ar-cok.h b/src/mt19937ar-cok/mt19937ar-cok.h similarity index 100% rename from src/mt19937ar-cok.h rename to src/mt19937ar-cok/mt19937ar-cok.h diff --git a/src/prng.c b/src/prng.c index e36ce91..f542a07 100644 --- a/src/prng.c +++ b/src/prng.c @@ -21,8 +21,8 @@ #include "prng.h" #include "logging.h" -#include "mt19937ar-cok.h" -#include "isaac_rand.h" +#include "mt19937ar-cok/mt19937ar-cok.h" +#include "isaac_rand/isaac_rand.h" nwipe_prng_t nwipe_twister = {"Mersenne Twister (mt19937ar-cok)", nwipe_twister_init, nwipe_twister_read};