diff --git a/Makefile b/Makefile index f2cae5d..1a204ea 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,8 @@ NAME = scl -CC = gcc -CFLAGS_REG = -Wall -O2 -CFLAGS_DBG = -ggdb -fsanitize=address -O0 -LDFLAGS = -lm +CC = clang +CFLAGS = -Wall --std=c11 +LDFLAGS = SRC_DIR = src OBJ_DIR = obj @@ -12,35 +11,19 @@ TARGET = $(NAME).out SRC_FILES = $(wildcard $(SRC_DIR)/*.c) OBJ_FILES = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC_FILES)) -COL_BOLD = \x1b[37;1m -COL_CLEAR = \x1b[0m +all: $(TARGET) -all: reg +$(TARGET): $(OBJ_FILES) + @ echo -e "\x1b[32;1mLinking \x1b[0m\x1b[32m$(TARGET)\x1b[32;1m...\x1b[0m\x1b[37m $(CC) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS)\x1b[0m" + @ $(CC) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS) -reg: CFLAGS = $(CFLAGS_REG) -reg: $(TARGET) - -dbg: CFLAGS = $(CFLAGS_DBG) -dbg: clean -dbg: $(TARGET) - -msg_compiling: - @ echo -e "$(COL_BOLD)Compiling...$(COL_CLEAR)" - -msg_linking: - @ echo -e "$(COL_BOLD)Linking...$(COL_CLEAR)" - -msg_cleaning: - @ echo -e "$(COL_BOLD)Cleaning up...$(COL_CLEAR)" - -$(TARGET): msg_compiling $(OBJ_FILES) msg_linking - $(CC) $(LDFLAGS) $(OBJ_FILES) -o $@ - -$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(SRC_DIR)/include/%.h @ mkdir -p $(OBJ_DIR) - $(CC) $(CFLAGS) -c $< -o $@ + @ echo -e "\x1b[32;1mCompiling \x1b[0m\x1b[32m$<\x1b[32;1m... \x1b[0m\x1b[37m$(CC) $(CFLAGS) -c $< -o $@\x1b[0m" + @ $(CC) $(CFLAGS) -c $< -o $@ -clean: msg_cleaning - rm -rf $(OBJ_DIR) $(TARGET) $(TARGET_DBG) +clean: + @ echo -e "\x1b[32;1mCleaning up...\x1b[0m" + @ rm -rf $(OBJ_DIR) $(TARGET) -.PHONY: all clean reg dbg msg_compiling msg_linking msg_cleaning +.PHONY: all clean diff --git a/src/main.c b/src/main.c index 1817149..5eb52dd 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ #include int main(int argc, char** argv) { - printf("Hello, world!"); + printf("Hello, world!\n"); return 0; }