Blame Makefile

Kylie McClain b61f59
CC				?=cc
Kylie McClain b61f59
CFLAGS			?=-O2 -g
Kylie McClain b61f59
Kylie McClain b61f59
prefix			?=/usr/local
Kylie McClain b61f59
exec_prefix		?=$(prefix)
Kylie McClain b61f59
bindir			?=$(exec_prefix)/bin
Kylie McClain b61f59
includedir		?=$(exec_prefix)/include
Kylie McClain b61f59
libdir			?=$(exec_prefix)/lib
Kylie McClain b61f59
datarootdir		?=$(prefix)/share
Kylie McClain b61f59
datadir			?=$(datarootdir)
Kylie McClain b61f59
docdir			?=$(datarootdir)/doc/musl-compat-$(VERSION)
Kylie McClain b61f59
mandir			?=$(datarootdir)/man
Kylie McClain b61f59
Kylie McClain 37edee
BINS			:= $(notdir $(basename $(wildcard bin/*.c)))
Kylie McClain 37edee
BINS_SH			:= $(notdir $(basename $(wildcard bin/*.sh)))
Kylie McClain 37edee
INCLUDES		:= $(shell find include/ -type f -name '*.h')
Kylie McClain 37edee
INCLUDES        := $(INCLUDES:include/%=%)
Kylie McClain 37edee
LIBS			:= $(notdir $(wildcard lib/*.a))
Kylie McClain b61f59
Kylie McClain 704c7c
VERSION			=2
Kylie McClain b61f59
Kylie McClain b61f59
build:	bin/getconf.o bin/getent.o bin/ldconfig.sh
Kylie McClain b61f59
Kylie McClain b61f59
bin/%.sh: bin/%.sh.in
Kylie McClain b61f59
	cp $< $@
Kylie McClain b61f59
	chmod +x "$@"
Kylie McClain b61f59
Kylie McClain b61f59
bin/%.o: bin/%.c
Kylie McClain b61f59
	$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@
Kylie McClain b61f59
Kylie McClain b61f59
$(DESTDIR)$(bindir)/%: bin/$(notdir %)
Kylie McClain 1ce61e
	install -D -m 755 $< $(basename $@)
Kylie McClain b61f59
Kylie McClain b61f59
$(DESTDIR)$(includedir)/%: include/$(notdir %)
Kylie McClain 1ce61e
	install -D -m 644 $< $@
Kylie McClain b61f59
Kylie McClain b61f59
$(DESTDIR)$(libdir)/%: lib/$(notdir %)
Kylie McClain 1ce61e
	install -D -m 755 $< $@
Kylie McClain b61f59
Kylie McClain b61f59
install: build $(foreach b,$(BINS),$(DESTDIR)$(bindir)/$(b).o) $(foreach b,$(BINS_SH),$(DESTDIR)$(bindir)/$(b).sh) $(foreach i,$(INCLUDES),$(DESTDIR)$(includedir)/$(i)) $(foreach l,$(LIBS),$(DESTDIR)$(libdir)/$(l))
Kylie McClain b61f59
Kylie McClain b61f59
clean:
Kylie McClain b61f59
	rm -rf $(foreach b,$(BINS),bin/$(b).o) $(foreach b,$(BINS_SH),bin/$(b).sh)
Kylie McClain b61f59
Kylie McClain b61f59
.PHONY:	all build clean install