diff options
| -rw-r--r-- | Makefile | 22 | ||||
| -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
@@ -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 |
