Compare commits
No commits in common. "60d1edccccc55c81cb30a908a689922d731774f1" and "c1c27f91b61049d4729d11712070082f0c5107c6" have entirely different histories.
60d1edcccc
...
c1c27f91b6
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,3 @@
|
|||||||
*.out
|
*.out
|
||||||
obj/
|
obj/
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
.cache
|
|
||||||
|
45
Makefile
45
Makefile
@ -1,8 +1,9 @@
|
|||||||
NAME = scl
|
NAME = scl
|
||||||
|
|
||||||
CC = clang
|
CC = gcc
|
||||||
CFLAGS = -Wall --std=c11
|
CFLAGS_REG = -Wall -O2
|
||||||
LDFLAGS =
|
CFLAGS_DBG = -ggdb -fsanitize=address -O0
|
||||||
|
LDFLAGS = -lm
|
||||||
|
|
||||||
SRC_DIR = src
|
SRC_DIR = src
|
||||||
OBJ_DIR = obj
|
OBJ_DIR = obj
|
||||||
@ -11,19 +12,35 @@ TARGET = $(NAME).out
|
|||||||
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
|
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
|
||||||
OBJ_FILES = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC_FILES))
|
OBJ_FILES = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC_FILES))
|
||||||
|
|
||||||
all: $(TARGET)
|
COL_BOLD = \x1b[37;1m
|
||||||
|
COL_CLEAR = \x1b[0m
|
||||||
|
|
||||||
$(TARGET): $(OBJ_FILES)
|
all: reg
|
||||||
@ 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)
|
|
||||||
|
|
||||||
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(SRC_DIR)/include/%.h
|
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
|
||||||
@ mkdir -p $(OBJ_DIR)
|
@ mkdir -p $(OBJ_DIR)
|
||||||
@ 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 $@
|
||||||
@ $(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
clean:
|
clean: msg_cleaning
|
||||||
@ echo -e "\x1b[32;1mCleaning up...\x1b[0m"
|
rm -rf $(OBJ_DIR) $(TARGET) $(TARGET_DBG)
|
||||||
@ rm -rf $(OBJ_DIR) $(TARGET)
|
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean reg dbg msg_compiling msg_linking msg_cleaning
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
printf("Hello, world!\n");
|
printf("Hello, world!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user