include config.mk SRC = $(shell find src/ -type f -name '*.c') OBJ = $(SRC:%=$(BUILD_DIR)/%.o) H = include/uv_link_t.h .PHONY: all static shared clean install-static install-shared install all: static shared static: $(SNAME) shared: $(DNAME) $(OBJ): config.mk $(SNAME): $(OBJ) ar rcs $@ $? $(DNAME): LDFLAGS += -shared $(DNAME): $(OBJ) $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(BUILD_DIR)/%.c.o: %.c mkdir -p '$(@D)' $(CC) -c -o $@ $(INCLUDES) $(CFLAGS) $< clean: rm -rf $(SNAME) $(DNAME) $(BUILD_DIR) install-header: $(H) install -d $(DESTDIR)$(INCLUDEDIR) install -m 644 $^ $(DESTDIR)$(INCLUDEDIR) install-static: $(SNAME) install -d $(DESTDIR)$(LIBDIR) install -m 755 $^ $(DESTDIR)$(LIBDIR) install-shared: $(DNAME) install -d $(DESTDIR)$(LIBDIR) install -m 755 $^ $(DESTDIR)$(LIBDIR) install: install-header install-static install-shared