commit 3952044d51644070bdd57c00a95a1fb55d9ce0ff
parent 1b07b251bbdfcf532e78ee27e6fb46460e408b75
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Fri, 16 Jul 2021 19:05:19 -0700
Add header and library prerequisites to mkfiles
Diffstat:
6 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/apc/mkfile b/apc/mkfile
@@ -2,6 +2,7 @@
name = apc
src = apc.c die.c
+hdr = config.h die.h
obj = ${src:%.c=%.o}
lib = ap
mk = ../mk
@@ -12,7 +13,14 @@ ldlibs = ${lib:%=-l%}
all:V: $name
+dir: ${lib:%=../lib/%}
+
+$obj: mkfile $hdr
+
+$name: dir
+
< $mk/config.mk
< $mk/clean.mk
+< $mk/dir.mk
< $mk/obj.mk
< $mk/prog.mk
diff --git a/aps/mkfile b/aps/mkfile
@@ -3,6 +3,7 @@
name = aps
src = aps.c arg.c buf.c bug.c command.c find.c item.c log.c main.c match.c player.c queue.c response.c split.c
obj = ${src:%.c=%.o}
+hdr = aps.h arg.h buf.h bug.h command.h config.h find.h item.h log.h match.h player.h queue.h response.h split.h util.h
lib = ap
mk = ../mk
@@ -12,7 +13,14 @@ ldlibs = ${lib:%=-l%}
all:V: $name
+dir: ${lib:%=../lib/%}
+
+$obj: mkfile $hdr
+
+$name: dir
+
< $mk/config.mk
< $mk/clean.mk
+< $mk/dir.mk
< $mk/obj.mk
< $mk/prog.mk
diff --git a/lib/ap/mkfile b/lib/ap/mkfile
@@ -8,6 +8,7 @@ mk = ../../mk
cppflags = -I$hdir
+$name: $obj
all:V: $name
< $mk/config.mk
diff --git a/mk/dir.mk b/mk/dir.mk
@@ -0,0 +1,10 @@
+# Copyright 2021 Jacob R. Edwards
+
+dir:Q:
+ PS4=''
+ set -x
+ for dir in $prereq
+ do (
+ cd $dir
+ mk $MKFLAGS
+ ) done
diff --git a/mk/prog.mk b/mk/prog.mk
@@ -1,7 +1,7 @@
# Copyright 2021 Jacob R. Edwards
$name: $obj
- $cc $ldflags -o $target $prereq $ldlibs
+ $cc $ldflags -o $target $obj $ldlibs
install:V: $name
cp -f $name $prefix/bin
diff --git a/mkfile b/mkfile
@@ -5,6 +5,11 @@ targets = all install uninstall clean
all:V:
-$targets:V:
+$targets:VQ:
+ PS4=''
set -x
- for dir in $subdirs; do (cd $dir && mk $MKFLAGS $MKARGS) done
+ for dir in $subdirs
+ do (
+ cd $dir
+ mk $MKFLAGS $MKARGS
+ ) done