Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-12-17 21:42:35 -0500
committerDan McGee <dan@archlinux.org>2011-12-21 18:13:17 -0600
commitd6ccd4439044978a6dcc01b8c1ab880b6164f9d1 (patch)
treeba8360f6e0177fa9ad13d1b794a21cae00bdbc01
parent6c1426842af7de1343b8360e2d0ca52846ea4a2f (diff)
include config.h via Makefiles
Ensures that config.h is always ordered correctly (first) in the includes. Also means that new source files get this for free without having to remember to add it. We opt for -imacros over -include as its more portable, and the added constraint by -imacros doesn't bother us for config.h. This also touches the HACKING file to remove the explicit mention of config.h as part of the includes. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--HACKING4
-rw-r--r--lib/libalpm/Makefile.am3
-rw-r--r--lib/libalpm/add.c2
-rw-r--r--lib/libalpm/alpm.c2
-rw-r--r--lib/libalpm/backup.c2
-rw-r--r--lib/libalpm/be_local.c2
-rw-r--r--lib/libalpm/be_package.c2
-rw-r--r--lib/libalpm/be_sync.c2
-rw-r--r--lib/libalpm/conflict.c2
-rw-r--r--lib/libalpm/db.c2
-rw-r--r--lib/libalpm/delta.c2
-rw-r--r--lib/libalpm/delta.h2
-rw-r--r--lib/libalpm/deps.c2
-rw-r--r--lib/libalpm/diskspace.c2
-rw-r--r--lib/libalpm/dload.c2
-rw-r--r--lib/libalpm/error.c2
-rw-r--r--lib/libalpm/graph.c2
-rw-r--r--lib/libalpm/graph.h2
-rw-r--r--lib/libalpm/group.c2
-rw-r--r--lib/libalpm/handle.c2
-rw-r--r--lib/libalpm/log.c2
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/package.h2
-rw-r--r--lib/libalpm/remove.c2
-rw-r--r--lib/libalpm/signing.c2
-rw-r--r--lib/libalpm/sync.c2
-rw-r--r--lib/libalpm/trans.c2
-rw-r--r--lib/libalpm/util.c2
-rw-r--r--lib/libalpm/util.h2
-rw-r--r--lib/libalpm/version.c2
-rw-r--r--src/pacman/Makefile.am5
-rw-r--r--src/pacman/callback.c2
-rw-r--r--src/pacman/conf.c2
-rw-r--r--src/pacman/database.c2
-rw-r--r--src/pacman/deptest.c2
-rw-r--r--src/pacman/package.c2
-rw-r--r--src/pacman/pacman.c2
-rw-r--r--src/pacman/query.c2
-rw-r--r--src/pacman/remove.c2
-rw-r--r--src/pacman/sync.c2
-rw-r--r--src/pacman/upgrade.c2
-rw-r--r--src/pacman/util.c2
-rw-r--r--src/util/Makefile.am5
-rw-r--r--src/util/cleanupdelta.c2
-rw-r--r--src/util/pacsort.c2
-rw-r--r--src/util/pactree.c2
-rw-r--r--src/util/testdb.c2
47 files changed, 13 insertions, 90 deletions
diff --git a/HACKING b/HACKING
index e829e5d7..8a59344e 100644
--- a/HACKING
+++ b/HACKING
@@ -114,8 +114,6 @@ general pattern, including blank lines:
[source,C]
-------------------------------------------
-#include "config.h"
-
#include <standardheader.h>
#include <another.h>
#include <...>
@@ -144,6 +142,8 @@ For pacman:
#include "anythingelse.h"
-------------------------------------------
+Never directly include config.h. This will always be added via Makefiles.
+
GDB and Valgrind Usage
~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 99f9c1b7..61dcb877 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -7,6 +7,9 @@ include_HEADERS = alpm_list.h alpm.h
DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@
+AM_CPPFLAGS = \
+ -imacros $(top_builddir)/config.h
+
AM_CFLAGS = -pedantic -D_GNU_SOURCE
if ENABLE_VISIBILITY_CC
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 78615bb1..014990d2 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <errno.h>
#include <string.h>
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index e957f1aa..3f7ab4ba 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#ifdef HAVE_LIBCURL
#include <curl/curl.h>
#endif
diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c
index 728c1d05..68856deb 100644
--- a/lib/libalpm/backup.c
+++ b/lib/libalpm/backup.c
@@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 606f9e1a..2deef22c 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 4f530e0b..41ecc75a 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <string.h>
#include <errno.h>
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 54c4f879..abc4a997 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 5703aba8..b5c55dc7 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -22,8 +22,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 7708d18f..3e534358 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -22,8 +22,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 53c83657..1272558e 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <string.h>
#include <stdint.h> /* intmax_t */
diff --git a/lib/libalpm/delta.h b/lib/libalpm/delta.h
index 05df4207..42353f5f 100644
--- a/lib/libalpm/delta.h
+++ b/lib/libalpm/delta.h
@@ -20,8 +20,6 @@
#ifndef _ALPM_DELTA_H
#define _ALPM_DELTA_H
-#include "config.h" /* ensure off_t is correct length */
-
#include <sys/types.h> /* off_t */
#include "alpm.h"
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 9f7e9028..9d7e5470 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index cfd6402c..274aa676 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <errno.h>
#if defined(HAVE_MNTENT_H)
#include <mntent.h>
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index bcbc8095..a3980d65 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 044dec7c..528a3dcf 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#ifdef HAVE_LIBCURL
#include <curl/curl.h>
#endif
diff --git a/lib/libalpm/graph.c b/lib/libalpm/graph.c
index 3a7f24b8..d080e05b 100644
--- a/lib/libalpm/graph.c
+++ b/lib/libalpm/graph.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include "graph.h"
#include "util.h"
#include "log.h"
diff --git a/lib/libalpm/graph.h b/lib/libalpm/graph.h
index d4d134b5..2910b7d6 100644
--- a/lib/libalpm/graph.h
+++ b/lib/libalpm/graph.h
@@ -19,8 +19,6 @@
#ifndef _ALPM_GRAPH_H
#define _ALPM_GRAPH_H
-#include "config.h" /* ensure off_t is correct length */
-
#include <sys/types.h> /* off_t */
#include "alpm_list.h"
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index 47458df2..8b407b26 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 01f59555..6518b7d5 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <errno.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c
index 692ff79c..14b454e6 100644
--- a/lib/libalpm/log.c
+++ b/lib/libalpm/log.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index e96177a2..68fec16a 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 82a83264..172d2f36 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -24,8 +24,6 @@
#ifndef _ALPM_PACKAGE_H
#define _ALPM_PACKAGE_H
-#include "config.h" /* ensure off_t is correct length */
-
#include <sys/types.h> /* off_t */
#include "alpm.h"
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index d7e06bc8..8967eff7 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -22,8 +22,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <errno.h>
#include <string.h>
diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 0bef4451..fbb6b134 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 0c6ec9ea..49a3f42d 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <stdio.h>
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index cb97a4aa..5ceaaa70 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -21,8 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 4eeb0cd7..b2974a48 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -22,8 +22,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 1e192747..54e69c19 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -24,8 +24,6 @@
#ifndef _ALPM_UTIL_H
#define _ALPM_UTIL_H
-#include "config.h"
-
#include "alpm_list.h"
#include "alpm.h"
#include "package.h" /* alpm_pkg_t */
diff --git a/lib/libalpm/version.c b/lib/libalpm/version.c
index 6b65a413..a88b8180 100644
--- a/lib/libalpm/version.c
+++ b/lib/libalpm/version.c
@@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <string.h>
#include <ctype.h>
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am
index 3790bdf4..795b2d1a 100644
--- a/src/pacman/Makefile.am
+++ b/src/pacman/Makefile.am
@@ -17,7 +17,10 @@ DEFS = -DLOCALEDIR=\"@localedir@\" \
-DCACHEDIR=\"$(cachedir)\" \
-DLOGFILE=\"$(logfile)\" \
@DEFS@
-INCLUDES = -I$(top_srcdir)/lib/libalpm
+
+AM_CPPFLAGS = \
+ -imacros $(top_builddir)/config.h \
+ -I$(top_srcdir)/lib/libalpm
AM_CFLAGS = -pedantic -D_GNU_SOURCE
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index c118940d..87ba30af 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 482a86d9..6703243a 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <errno.h>
#include <glob.h>
#include <limits.h>
diff --git a/src/pacman/database.c b/src/pacman/database.c
index 3e4a672f..b9736618 100644
--- a/src/pacman/database.c
+++ b/src/pacman/database.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <alpm.h>
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 0bf9cd80..63e7985d 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <alpm.h>
diff --git a/src/pacman/package.c b/src/pacman/package.c
index d4bbf886..233e8e24 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index d2fa62f8..3e17d905 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
/* special handling of package version for GIT */
#if defined(GIT_VERSION)
#undef PACKAGE_VERSION
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 4c2ea817..66813e35 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index b6da7c3f..3de57695 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <fnmatch.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 9015b086..a13b6c7f 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 650af6b0..87f7c390 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 12f3dcae..7846291e 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index e4af56cf..2110781b 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -11,7 +11,10 @@ DEFS = -DLOCALEDIR=\"@localedir@\" \
-DDBPATH=\"$(dbpath)\" \
-DCACHEDIR=\"$(cachedir)\" \
@DEFS@
-INCLUDES = -I$(top_srcdir)/lib/libalpm
+
+AM_CPPFLAGS = \
+ -imacros $(top_builddir)/config.h \
+ -I$(top_srcdir)/lib/libalpm
AM_CFLAGS = -pedantic -D_GNU_SOURCE
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index d6bd0e86..ea34fe7f 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/util/pacsort.c b/src/util/pacsort.c
index 0eedf59d..7275cc77 100644
--- a/src/util/pacsort.c
+++ b/src/util/pacsort.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <errno.h>
#include <getopt.h>
#include <stdio.h>
diff --git a/src/util/pactree.c b/src/util/pactree.c
index f95c5e89..55d63d7c 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <ctype.h>
#include <getopt.h>
#include <stdio.h>
diff --git a/src/util/testdb.c b/src/util/testdb.c
index b15bbe5e..4f6bfed5 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>