scaler/Makefile

40 lines
659 B
Makefile

# Makefile
TARGET := scaler
SRCS := scaler.c
OBJS := $(SRCS:.c=.o)
define lib-paths
$(strip \
$(shell $(CC) -print-search-dirs | \
grep "^libraries" | \
sed 's/^libraries *: *=//' | \
sed 's/:/ /g') \
)
endef
define lib-for
$(strip \
$(eval _d := $(lastword $(wildcard $(patsubst %,%lib$(1).a,$(call lib-paths))))) \
$(if $(_d),$(_d),$(error lib-for $(1) not found)) \
)
endef
LIBS := \
$(call lib-for,png) \
$(call lib-for,z) \
$(call lib-for,m)
.PHONY: all
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) -static -o $@ $^ $(LIBS)
%.o: %.c
$(CC) -Wall -c -o $@ $<
.PHONY: clean
clean:
rm -f scaler scaler.o