summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rw-r--r--pkgdb2-add.c6
-rw-r--r--pkgdb2-del.c6
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;