diff options
author | Simo Leone <simo@archlinux.org> | 2008-04-08 18:10:09 +0200 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-04-08 18:10:09 +0200 |
commit | 8a92487774b8d15be627f230a4f8d864cfcc9b8d (patch) | |
tree | 440437a9e3d3a279bf383b77408231275ee13fe0 | |
parent | 0e94987238ee78221892da19ab3219c49e621901 (diff) | |
download | dbscripts-8a92487774b8d15be627f230a4f8d864cfcc9b8d.tar.gz dbscripts-8a92487774b8d15be627f230a4f8d864cfcc9b8d.tar.xz |
Added a Makefile
Also fixed mysql include in pkgdb2-del.
Rigged some makefile defines for mysql info
instead of hardcoding into the source.
Signed-off-by: Simo Leone <simo@archlinux.org>
Aaron: Added -I for mysql includes
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | pkgdb2-add.c | 6 | ||||
-rw-r--r-- | pkgdb2-del.c | 6 |
3 files changed, 26 insertions, 6 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b66e271 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +# mysql db info. +DB_NAME:="archlinux" +DB_USER:="archlinux" +DB_PASS:="passwords-are-cool" + +MYSQL_DEFS:=-DDB_NAME=\"$(DB_NAME)\" -DDB_USER=\"$(DB_USER)\" -DDB_PASS=\"$(DB_PASS)\" +MYSQL_FLAGS:=-I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient + +all: pkgdb2-add pkgdb2-del + +pkgdb2-add: pkgdb2-add.c + gcc $(MYSQL_DEFS) $(MYSQL_FLAGS) -o pkgdb2-add pkgdb2-add.c + +pkgdb2-del: pkgdb2-del.c + gcc $(MYSQL_DEFS) $(MYSQL_FLAGS) -o pkgdb2-del pkgdb2-del.c + +clean: + rm -f pkgdb2-add pkgdb2-del + +.PHONY: all clean diff --git a/pkgdb2-add.c b/pkgdb2-add.c index 489074c..92d1339 100644 --- a/pkgdb2-add.c +++ b/pkgdb2-add.c @@ -4,9 +4,9 @@ #include <string.h> #include <limits.h> -#define DB_USER "archweb" -#define DB_NAME "archweb" -#define DB_PASS "passwords-are-cool" +#ifndef DB_PASS + #error "MySQL connection info undefined" +#endif typedef struct pkg { unsigned int id; diff --git a/pkgdb2-del.c b/pkgdb2-del.c index c81e542..3ceb580 100644 --- a/pkgdb2-del.c +++ b/pkgdb2-del.c @@ -4,9 +4,9 @@ #include <string.h> #include <limits.h> -#define DB_USER "archweb" -#define DB_NAME "archweb" -#define DB_PASS "passwords-are-cool" +#ifndef DB_PASS + #error "MySQL connection info undefined" +#endif typedef struct pkg { unsigned int id; |