2020-12-12 06:33:37 +00:00
|
|
|
CFLAGS += -std=c99 -pedantic -g
|
2020-12-02 02:34:05 +00:00
|
|
|
builddir = bin
|
|
|
|
prefix = /usr/local
|
|
|
|
exec_prefix = $(prefix)
|
|
|
|
bindir = $(exec_prefix)/bin
|
|
|
|
mandir = $(prefix)/man
|
|
|
|
INSTALLPROGRAM = \install
|
|
|
|
|
2020-12-12 06:33:37 +00:00
|
|
|
UTILS = asa basename cat cksum cmp dirname echo expand false head link ln \
|
|
|
|
logname pwd sleep tee true tty uname wc
|
2020-12-02 02:34:05 +00:00
|
|
|
|
|
|
|
all: $(UTILS)
|
|
|
|
|
|
|
|
install-strip: INSTALLPROGRAM = \install -s
|
|
|
|
install-strip: install
|
|
|
|
|
|
|
|
install: installdirs
|
|
|
|
$(INSTALLPROGRAM) $(builddir)/* $(bindir)
|
|
|
|
$(INSTALLPROGRAM) *.1 $(mandir)
|
|
|
|
|
|
|
|
%: %.c bindirs
|
|
|
|
$(CC) $(CFLAGS) -o $(builddir)/$@ $<
|
|
|
|
|
|
|
|
installdirs:
|
|
|
|
if [ ! -d "$(bindir)"]; then \
|
|
|
|
mkdir $(bindir); \
|
|
|
|
fi
|
|
|
|
|
|
|
|
bindirs:
|
|
|
|
if [ ! -d "$(builddir)" ]; then \
|
|
|
|
mkdir $(builddir); \
|
|
|
|
fi
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
#remove utilities in $(bindir)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm -rf $(builddir)
|