summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile22
-rw-r--r--src/dbhandling.c (renamed from dbhandling.c)0
-rw-r--r--src/dbhandling.h (renamed from dbhandling.h)0
-rw-r--r--src/enum.c (renamed from enum.c)0
-rw-r--r--src/enum.h (renamed from enum.h)0
-rw-r--r--src/main.c (renamed from main.c)0
6 files changed, 14 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index aaf0f79..47d1b05 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
SHELL = /bin/sh
CC = gcc
+SRC_DIR := src
+BUILD_DIR := build
+
PREFIX = /usr/local
BINDIR = /bin
@@ -9,8 +12,8 @@ INSTALL_DATA = install -m 644
CFLAGS = -Wall -Wextra
LIBS = -lsqlite3
-SRC = main.c dbhandling.c enum.c
-OBJ = ${SRC:.c=.o}
+SRC = ${wildcard ${SRC_DIR}/*.c}
+OBJ = ${SRC:${SRC_DIR}/%.c=${BUILD_DIR}/%.o}
BIN = libman
all: options ${BIN}
@@ -20,17 +23,20 @@ options:
@echo "CFLAGS = ${CFLAGS}"
@echo "CC = ${CC}"
-.c.o:
- ${CC} -c ${CFLAGS} ${SRC}
+${BUILD_DIR}/%.o: ${SRC_DIR}/%.c | ${BUILD_DIR}
+ ${CC} ${CFLAGS} -c $< -o $@
+
+libman: ${OBJ} | ${BUILD_DIR}
+ ${CC} ${CFLAGS} ${LIBS} ${OBJ} -o ${BUILD_DIR}/${BIN}
-libman: .c.o
- ${CC} ${CFLAGS} ${LIBS} ${OBJ} -o ${BIN}
+${BUILD_DIR}:
+ mkdir -p $@
install:
- ${INSTALL_PROGRAM} ${BIN} ${PREFIX}${BINDIR}/${BIN}
+ ${INSTALL_PROGRAM} ${BUILD_DIR}/${BIN} ${PREFIX}${BINDIR}/${BIN}
clean:
- ${RM} ${BIN}
+ ${RM} ${BUILD_DIR}/${BIN}
${RM} ${OBJ}
uninstall:
diff --git a/dbhandling.c b/src/dbhandling.c
index 0a588ca..0a588ca 100644
--- a/dbhandling.c
+++ b/src/dbhandling.c
diff --git a/dbhandling.h b/src/dbhandling.h
index fd21579..fd21579 100644
--- a/dbhandling.h
+++ b/src/dbhandling.h
diff --git a/enum.c b/src/enum.c
index ba0828f..ba0828f 100644
--- a/enum.c
+++ b/src/enum.c
diff --git a/enum.h b/src/enum.h
index 65cde6f..65cde6f 100644
--- a/enum.h
+++ b/src/enum.h
diff --git a/main.c b/src/main.c
index 9dfe71d..9dfe71d 100644
--- a/main.c
+++ b/src/main.c