aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-16 15:10:39 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-16 15:10:39 +0200
commitb79b9971471256bfb4bde919cd89ae164744eaba (patch)
tree1346befacd6f1c9a594149cd3f4738f299f84d7d /Makefile
parentChange (diff)
downloadlowbat-bsd-b79b9971471256bfb4bde919cd89ae164744eaba.tar.gz
lowbat-bsd-b79b9971471256bfb4bde919cd89ae164744eaba.tar.bz2
lowbat-bsd-b79b9971471256bfb4bde919cd89ae164744eaba.tar.xz
lowbat-bsd-b79b9971471256bfb4bde919cd89ae164744eaba.tar.zst
lowbat-bsd-b79b9971471256bfb4bde919cd89ae164744eaba.zip
Learning BSD make
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile52
1 files changed, 44 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 92d1631..982a772 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,61 @@
default: all
-
+SHELL := /bin/sh
# ============================================ DIRS ============================================== #
-SRCS_DIR = src/
-OBJS_DIR = obj/
-ASRCS_DIR = asm/
-AOBJS_DIR = asmobj/
+SRCS_DIR = src
+ASRCS_DIR = asm
+# ------------------------------------------------------------------------------------------------ #
+OBJS_DIR = obj
+AOBJS_DIR = asmobj
# =========================================== FILES ============================================== #
-
+SRCS = ${SRCS_DIR}/jo_main.c
+SRCS += ${SRCS_DIR}/jo_printf.c
# ========================================== COMPILER ============================================ #
CC = clang
+# ------------------------------------------------------------------------------------------------ #
CFLAGS = -std=c89
CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Werror
CFLAGS += -pedantic
# CFLAGS += -O2 -pipe
+# ------------------------------------------------------------------------------------------------ #
+NAME = lowbat
# ========================================== ASSEMBLER =========================================== #
ASM = nasm
ASMFLAGS = -f
ASMARCH = elf64_fbsd
+# ============================================ UNIX ============================================== #
+RM = rm -rf
+MKDIR = mkdir
+CP = cp
+MV = mv
+AWK = awk -F
+SED = sed
# ============================================ RULES ============================================= #
-all:
- ${CC}
+# .include "./.depend"
+
+depend:
+ pwd
+ ${CC} -I${SRCS_DIR}/ -E -MM ${SRCS} > .depend
+
+config:
+ ${MKDIR} ${OBJS_DIR}
+ ${SED} 's/^/${OBJS_DIR}\//' .depend > .depend.tmp
+ ${MV} .depend.tmp .depend
+
+all: depend config
+
+clean:
+ ${RM} ${OBJS_DIR}
+ ${RM} ${AOBJS_DIR}
+ ${RM} ${NAME}.core
+ ${RM} .depend
+ ${RM} .depend.tmp
+
+fclean: clean
+ ${RM} ${NAME}
+
+re: fclean all
+
+.PHONY: all clean fclean re depend config