From c9f687e0c16a7f6ea6471f69b6be8cb2f0a3268d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 3 Jan 2014 07:58:01 +0100 Subject: move arch specific macros to separate header file --- Makefile | 4 ++-- arch.c | 2 +- arch.h | 30 ++++++++++++++++++++++++++++++ config.def.h | 17 ----------------- pacredir.c | 1 + 5 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 arch.h diff --git a/Makefile b/Makefile index 1990fa3..90f77a2 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,10 @@ VERSION := 0.1.1 all: pacredir avahi/pacdbserve.service README.html -arch: arch.c config.h +arch: arch.c arch.h $(CC) -o arch arch.c -pacredir: pacredir.c pacredir.h config.h version.h +pacredir: pacredir.c arch.h pacredir.h config.h version.h $(CC) $(CFLAGS) $(LDFLAGS) -o pacredir pacredir.c config.h: diff --git a/arch.c b/arch.c index 1e644e9..3024ef9 100644 --- a/arch.c +++ b/arch.c @@ -8,7 +8,7 @@ #include #include -#include "config.h" +#include "arch.h" /*** main ***/ int main(int argc, char ** argv) { diff --git a/arch.h b/arch.h new file mode 100644 index 0000000..17301ce --- /dev/null +++ b/arch.h @@ -0,0 +1,30 @@ +/* + * (C) 2013-2014 by Christian Hesse + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ + +#ifndef _ARCH_H +#define _ARCH_H + +/* the binary needs to know its own architecture */ +#if defined __x86_64__ +# define ARCH "x86_64" +#elif defined __i386__ +# define ARCH "i686" +#elif defined __ARM_ARCH_7__ +# define ARCH "armv7h" +#elif defined __ARM_ARCH_6__ +# if defined __VFP_FP__ +# define ARCH "armv6h" +# else +# define ARCH "arm" +# endif +#else +# error Unknown architecture! +#endif + +#endif /* _ARCH_H */ + +// vim: set syntax=c: diff --git a/config.def.h b/config.def.h index 12a2728..ce0c142 100644 --- a/config.def.h +++ b/config.def.h @@ -8,23 +8,6 @@ #ifndef _CONFIG_H #define _CONFIG_H -/* the binary needs to know its own architecture */ -#if defined __x86_64__ -# define ARCH "x86_64" -#elif defined __i386__ -# define ARCH "i686" -#elif defined __ARM_ARCH_7__ -# define ARCH "armv7h" -#elif defined __ARM_ARCH_6__ -# if defined __VFP_FP__ -# define ARCH "armv6h" -# else -# define ARCH "arm" -# endif -#else -# error Unknown architecture! -#endif - /* This is used for default documents. Usually you will not see this anyway. */ #define PAGE307 "307 temporary redirect" \ "307 temporary redirect: " \ diff --git a/pacredir.c b/pacredir.c index 3fa70eb..99b000e 100644 --- a/pacredir.c +++ b/pacredir.c @@ -30,6 +30,7 @@ #include /* compile time configuration */ +#include "arch.h" #include "config.h" #include "version.h" -- cgit v1.2.3-70-g09d2