From 2a90ee943482d50d8111aaf9c8f80ad68e0ad49f Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 16 Oct 2019 21:36:36 -0400 Subject: automate dependency tracking some --- src/Makefile | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'src/Makefile') 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 -- cgit v1.2.1