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 b61f59
BINS			= $(notdir $(basename $(wildcard bin/*.c)))
Kylie McClain b61f59
BINS_SH			= $(notdir $(basename $(wildcard bin/*.sh)))
Kylie McClain b61f59
INCLUDES		= $(notdir $(wildcard include/*.h))
Kylie McClain b61f59
LIBS			= $(notdir $(wildcard lib/*.a))
Kylie McClain b61f59
Kylie McClain b61f59
VERSION			=1
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 b61f59
	install -D $< $(basename $@)
Kylie McClain b61f59
Kylie McClain b61f59
$(DESTDIR)$(includedir)/%: include/$(notdir %)
Kylie McClain b61f59
	install -D $< $@
Kylie McClain b61f59
Kylie McClain b61f59
$(DESTDIR)$(libdir)/%: lib/$(notdir %)
Kylie McClain b61f59
	install -D $< $@
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