esrpatch/makefile
2023-10-25 20:12:38 +02:00

26 lines
642 B
Makefile

CC := gcc #clang
PKGS :=
SRCDIR := .
BUILDDIR := build
CFLAGS := -g -Wall -std=c99 `pkg-config --cflags $(PKGS)`
LIBS := `pkg-config --libs $(PKGS)`
TARGET := esrpatch
SRCEXT = c
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
DEPS := $(OBJECTS:.o=.deps)
$(TARGET): $(OBJECTS)
@echo " Linking..."; $(CC) $^ -o $(TARGET) $(LIBS)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
@echo " CC $<"; $(CC) $(CFLAGS) -MD -MF $(@:.o=.deps) -c -o $@ $<
clean:
@echo " Cleaning..."; $(RM) -r $(BUILDDIR) $(TARGET)
-include $(DEPS)
.PHONY: clean