diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-03-13 15:58:09 +0100 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2025-03-13 15:58:09 +0100 |
commit | 5ba1561999f8df7e0e622db8686ec1c4e0045d5f (patch) | |
tree | 1ed2fa10f7cdaa27454c1b3937e07ead78b6536e /Makefile |
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f467e80 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +CC ?= clang + +BUILD = build + +TARGET = $(BUILD)/ihex +PREFIX = /usr + +SRC =\ + src/main.c\ + src/ihex.c\ + src/util.c\ + src/array.c + +INCLUDE = -Iinclude + +OBJ = $(patsubst src/%.c,$(BUILD)/%.o,$(SRC)) +DEPS = $(patsubst %.o,%.d,$(OBJ)) + +DEPFLAGS = -MP -MMD + +CFLAGS = $(DEPFLAGS) $(INCLUDE) -Wall -pedantic +LDFLAGS = + +all : $(TARGET) + +$(BUILD)/%.o : src/%.c + $(CC) $(CFLAGS) -c -o $@ $< + +$(TARGET) : $(OBJ) + $(CC) $(LDFLAGS) -o $@ $+ + +$(OBJ) : | $(BUILD) + +$(BUILD) : + mkdir -p $@ + +install : + mkdir -p $(PREFIX)/bin + install -m 755 $(TARGET) $(PREFIX)/bin + +uninstall : + rm -f $(PREFIX)/bin/ihex + +clean : + rm -rf build + +.PHONY : clean install + +-include $(DEPS) |