summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-10-16 21:36:36 -0400
committerJakob Kaivo <jkk@ung.org>2019-10-16 21:36:36 -0400
commit2a90ee943482d50d8111aaf9c8f80ad68e0ad49f (patch)
treea12c941b51cfb520a6baeadb0f6368fef6af93a0 /src/Makefile
parent18b7bc62379d13525520531a0aac94affbef1a9c (diff)
automate dependency tracking some
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/Makefile b/src/Makefile
index 3de2a68..82ac0b1 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -6,30 +6,18 @@ CFLAGS=-Wall -Wextra -Wpedantic
LDFLAGS=
LIBS=-ll -ly
-OBJS= ar.o asa.o \
- basename.o \
- cal.o cat.o chgrp.o chmod.o chown.o cksum.o cmp.o cp.o crontab.o ctags.o \
- date.o dd.o dirname.o du.o \
- ed.o env.o ex.o expand.o \
- file.o \
- getconf.o grep.o \
- head.o \
- iconv.o id.o \
- link.o ln.o locale.o logger.o logname.o ls.o \
- mkdir.o mkfifo.o more.o \
- nice.o nohup.o \
- od.o \
- paste.o pathchk.o printf.o \
- renice.o rm.o rmdir.o \
- sh.o sleep.o split.o strings.o stty.o sum.o \
- tail.o tee.o tput.o tr.o \
- uname.o unlink.o uudecode.o uuencode.o \
- wc.o who.o write.o
+include .deps.mk
+include .objs.mk
bosix: $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
-sh.o: sh.c mains.h builtins.h
+deps:
+ printf '.POSIX:\n\n' > .deps.mk
+ for i in *.c; do printf '%s.o: %s ' "$$(basename $$i .c)" "$$i"; grep include "$$i" | sed -e 's/^.*"\(.*\)".*/\1/g' | paste -d' ' -s -; printf '\t$$(CC) -c $$(CFLAGS) %s\n\n' "$$i"; done >> .deps.mk
+ printf '.POSIX:\n\nOBJS=' > .objs.mk
+ for i in *.c; do printf '\\\n\t%s.o' $$(basename $$i .c); done >> .objs.mk
+ printf '\n' >> .objs.mk
clean:
rm -f bosix *.o