aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-16 16:54:11 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-16 16:54:11 +0200
commitd0b93125e25e0e07a14f161748ee534800047ffb (patch)
tree7c8ad9d9d67a84992c10d4ce509dbb7339fa04fa
parentBSD make is bav (diff)
downloadlowbat-bsd-d0b93125e25e0e07a14f161748ee534800047ffb.tar.gz
lowbat-bsd-d0b93125e25e0e07a14f161748ee534800047ffb.tar.bz2
lowbat-bsd-d0b93125e25e0e07a14f161748ee534800047ffb.tar.xz
lowbat-bsd-d0b93125e25e0e07a14f161748ee534800047ffb.tar.zst
lowbat-bsd-d0b93125e25e0e07a14f161748ee534800047ffb.zip
Fine
-rw-r--r--Makefile51
-rw-r--r--src/jo_printf.c1
2 files changed, 31 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index 07889e9..4002515 100644
--- a/Makefile
+++ b/Makefile
@@ -2,14 +2,13 @@ default: all
SHELL := /bin/sh
# ============================================ DIRS ============================================== #
-SRCS_DIR = src
-ASRCS_DIR = asm
-# ------------------------------------------------------------------------------------------------ #
-OBJS_DIR = cobj
-AOBJS_DIR = asmobj
+C_SRCS_DIR = src
+A_SRCS_DIR = asm
# =========================================== FILES ============================================== #
-SRCS = ${SRCS_DIR}/jo_main.c
-SRCS += ${SRCS_DIR}/jo_printf.c
+C_SRCS = ${C_SRCS_DIR}/jo_main.c
+C_SRCS += ${C_SRCS_DIR}/jo_printf.c
+# ------------------------------------------------------------------------------------------------ #
+C_OBJS = ${C_SRCS:.c=.o}
# ========================================== COMPILER ============================================ #
CC = clang
# ------------------------------------------------------------------------------------------------ #
@@ -18,41 +17,51 @@ CFLAGS += -Wall
CFLAGS += -Wextra
CFLAGS += -Werror
CFLAGS += -pedantic
-# CFLAGS += -O2 -pipe
+CFLAGS += ${DEBUG}
+# CFLAGS += ${OPTI}
# ------------------------------------------------------------------------------------------------ #
-NAME = lowbat
+OPTI = -O2 -pipe
+DEBUG = -glldb
+# ------------------------------------------------------------------------------------------------ #
+TARGET = lowbat
# ========================================== ASSEMBLER =========================================== #
ASM = nasm
ASMFLAGS = -f
ASMARCH = elf64_fbsd
# ============================================ UNIX ============================================== #
-RM = rm -rf
+RM = rm -f
MKDIR = mkdir -p
CP = cp
MV = mv
-AWK = awk -F
SED = sed
# ============================================ RULES ============================================= #
+.SUFFIXES: .c .o
+
+.c.o:
+ ${CC} -c ${CFLAGS} -I${C_SRCS_DIR} ${.IMPSRC} -o ${.TARGET}
+
+${TARGET}: ${C_OBJS}
+ ${CC} ${CFLAGS} -I${C_SRCS_DIR} -o ${.TARGET} ${.ALLSRC}
+
depend:
- ${CC} -I${SRCS_DIR}/ -E -MM ${SRCS} > .depend
- ${SED} 's/^/${OBJS_DIR}\//' .depend > .depend.tmp
+ ${CC} -I${C_SRCS_DIR} -E -MM ${C_SRCS} > .depend
+ ${SED} 's/^/${C_SRCS_DIR}\//' .depend > .depend.tmp
${MV} .depend.tmp .depend
- ${MKDIR} ${OBJS_DIR}
-all: depend
-# .include "./.depend"
+all: depend ${TARGET}
clean:
- ${RM} ${OBJS_DIR}
- ${RM} ${AOBJS_DIR}
- ${RM} ${NAME}.core
+ ${RM} ${C_OBJS}
+ ${RM} ${TARGET}.core
${RM} .depend
${RM} .depend.tmp
fclean: clean
- ${RM} ${NAME}
+ ${RM} ${TARGET}
re: fclean all
-.PHONY: all clean fclean re depend config
+.PHONY: all clean fclean re depend
+
+-include "./.depend"
diff --git a/src/jo_printf.c b/src/jo_printf.c
index facdaa1..066712b 100644
--- a/src/jo_printf.c
+++ b/src/jo_printf.c
@@ -4,5 +4,6 @@
void
jo_printf(void)
{
+
printf("Hey!\n");
}