AS := as LD := ld ASFLAGS := -g LDFLAGS := -g SRCS := $(shell find . -name '*.s') OBJS := $(patsubst %.s, %.o, $(SRCS)) TARGET := sorter VER := $(shell git describe --tags --abbrev=0 2> /dev/null || echo 'v0.0.0') all: $(TARGET) $(TARGET): $(OBJS) $(LD) $(LDFLAGS) $(OBJS) -o $@ %.o: %.s @mkdir -p $(dir $@) $(AS) $(ASFLAGS) $< -o $@ deploy: $(TARGET) tar -czvf $(TARGET)-$(VER).tar.gz $(TARGET) docs/sorter.1 clean: rm -f $(TARGET) $(OBJS) *.tar.gz .PHONY: all clean deploy