From b79b9971471256bfb4bde919cd89ae164744eaba Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 16 Apr 2020 15:10:39 +0200 Subject: Learning BSD make --- Makefile | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.3