2011-05-23 01:36:34 +00:00
|
|
|
include config.mk
|
|
|
|
|
2011-05-27 00:20:03 +00:00
|
|
|
HDR = text.h util.h
|
2011-06-03 04:38:40 +00:00
|
|
|
LIB = \
|
|
|
|
util/afgets.o \
|
|
|
|
util/agetcwd.o \
|
|
|
|
util/concat.o \
|
|
|
|
util/enmasse.o \
|
|
|
|
util/eprintf.o \
|
2011-06-10 01:56:13 +00:00
|
|
|
util/putword.o \
|
2011-06-03 04:38:40 +00:00
|
|
|
util/recurse.o \
|
|
|
|
|
|
|
|
SRC = \
|
|
|
|
basename.c \
|
|
|
|
cat.c \
|
|
|
|
chmod.c \
|
|
|
|
chown.c \
|
2011-06-10 03:14:05 +00:00
|
|
|
cksum.c \
|
2011-06-10 00:55:12 +00:00
|
|
|
cmp.c \
|
2011-06-03 04:38:40 +00:00
|
|
|
date.c \
|
|
|
|
dirname.c \
|
|
|
|
echo.c \
|
|
|
|
false.c \
|
2011-06-08 20:30:33 +00:00
|
|
|
fold.c \
|
2011-06-03 04:38:40 +00:00
|
|
|
grep.c \
|
|
|
|
head.c \
|
2011-06-10 01:29:10 +00:00
|
|
|
kill.c \
|
2011-06-03 04:38:40 +00:00
|
|
|
ln.c \
|
|
|
|
ls.c \
|
|
|
|
mkdir.c \
|
|
|
|
mkfifo.c \
|
|
|
|
nl.c \
|
|
|
|
pwd.c \
|
|
|
|
rm.c \
|
|
|
|
sleep.c \
|
|
|
|
sort.c \
|
|
|
|
tail.c \
|
|
|
|
tee.c \
|
|
|
|
touch.c \
|
|
|
|
true.c \
|
|
|
|
tty.c \
|
|
|
|
uname.c \
|
|
|
|
wc.c
|
2011-05-27 00:20:03 +00:00
|
|
|
|
2011-05-24 12:00:30 +00:00
|
|
|
OBJ = $(SRC:.c=.o) $(LIB)
|
2011-05-23 01:36:34 +00:00
|
|
|
BIN = $(SRC:.c=)
|
|
|
|
MAN = $(SRC:.c=.1)
|
|
|
|
|
|
|
|
all: $(BIN)
|
|
|
|
|
2011-05-29 20:30:44 +00:00
|
|
|
$(OBJ): util.h config.mk
|
2011-05-24 12:00:30 +00:00
|
|
|
$(BIN): util.a
|
2011-05-27 00:20:03 +00:00
|
|
|
cat.o grep.o tail.o: text.h
|
2011-05-23 01:36:34 +00:00
|
|
|
|
|
|
|
.o:
|
2011-05-29 20:30:44 +00:00
|
|
|
@echo LD -o $@
|
|
|
|
@$(LD) -o $@ $< util.a $(LDFLAGS)
|
2011-05-23 01:36:34 +00:00
|
|
|
|
|
|
|
.c.o:
|
|
|
|
@echo CC -c $<
|
2011-05-24 12:00:30 +00:00
|
|
|
@$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
|
|
|
|
util.a: $(LIB)
|
2011-06-01 20:31:22 +00:00
|
|
|
@echo AR -r $@
|
|
|
|
@$(AR) -r -c $@ $(LIB)
|
2011-05-23 01:36:34 +00:00
|
|
|
|
2011-06-08 15:26:05 +00:00
|
|
|
install: all
|
2011-06-08 10:37:00 +00:00
|
|
|
@echo installing executables to $(DESTDIR)$(PREFIX)/bin
|
|
|
|
@mkdir -p $(DESTDIR)$(PREFIX)/bin
|
|
|
|
@cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
|
|
|
|
@cd $(DESTDIR)$(PREFIX)/bin && chmod 755 $(BIN)
|
|
|
|
@echo installing manual pages to $(DESTDIR)$(MANPREFIX)/man1
|
|
|
|
@mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
|
|
|
@cp -f $(MAN) $(DESTDIR)$(MANPREFIX)/man1
|
|
|
|
@cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN)
|
|
|
|
|
|
|
|
uninstall:
|
2011-06-08 20:30:33 +00:00
|
|
|
@echo removing executables from $(DESTDIR)$(PREFIX)/bin
|
2011-06-08 10:37:00 +00:00
|
|
|
@cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN)
|
2011-06-08 20:30:33 +00:00
|
|
|
@echo removing manual pages from $(DESTDIR)$(MANPREFIX)/man1
|
2011-06-08 10:37:00 +00:00
|
|
|
@cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN)
|
|
|
|
|
2011-05-23 01:36:34 +00:00
|
|
|
dist: clean
|
|
|
|
@echo creating dist tarball
|
|
|
|
@mkdir -p sbase-$(VERSION)
|
2011-05-27 00:20:03 +00:00
|
|
|
@cp -r LICENSE Makefile config.mk $(SRC) $(MAN) util $(HDR) sbase-$(VERSION)
|
2011-05-23 01:36:34 +00:00
|
|
|
@tar -cf sbase-$(VERSION).tar sbase-$(VERSION)
|
|
|
|
@gzip sbase-$(VERSION).tar
|
|
|
|
@rm -rf sbase-$(VERSION)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo cleaning
|
2011-05-24 12:00:30 +00:00
|
|
|
@rm -f $(BIN) $(OBJ) $(LIB) util.a
|