diff options
author | mattkae <mattkae@protonmail.com> | 2023-04-23 20:23:54 -0400 |
---|---|---|
committer | mattkae <mattkae@protonmail.com> | 2023-04-23 20:23:54 -0400 |
commit | 4058f9b1704322f8185136c2558c2ab96a4d835c (patch) | |
tree | f764007c2cdd0f41372d66dcf02ccde26509b839 /Makefile |
Initial commit with a working parser
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e453aa6 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +TARGET_EXEC ?= html_parser + +BUILD_DIR ?= ./build +SRC_DIRS ?= ./src + +CC := g++ -g +SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s) +OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) +DEPS := $(OBJS:.o=.d) + +INC_DIRS := $(shell find $(SRC_DIRS) -type d) +INC_FLAGS := $(addprefix -I,$(INC_DIRS)) + +CPPFLAGS ?= $(INC_FLAGS) -MMD -MP + +$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS) + $(CC) $(OBJS) -o $@ -lmatte + +# assembly +$(BUILD_DIR)/%.s.o: %.s + $(MKDIR_P) $(dir $@) + $(AS) $(ASFLAGS) -c $< -o $@ + +# c source +$(BUILD_DIR)/%.c.o: %.c + $(MKDIR_P) $(dir $@) + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ + +# c++ source +$(BUILD_DIR)/%.cpp.o: %.cpp + $(MKDIR_P) $(dir $@) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ + + +.PHONY: clean + +clean: + $(RM) -r $(BUILD_DIR) + +all: + $(BUILD_DIR)/$(TARGET_EXEC) + +-include $(DEPS) + +MKDIR_P ?= mkdir -p |