ref: b1450d7399beff55b2bf98c9338cc757e1e47c64
parent: 965aa5892485f352eb054408f435f44c24aaf456
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 17 01:15:29 EDT 2018
[driver/posix] Use mkdep.sh script
--- a/driver/posix/Makefile
+++ b/driver/posix/Makefile
@@ -1,31 +1,15 @@
.POSIX:
PROJECTDIR = ../..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
-include $(LIBDIR)/libdep.mk
+include $(LIBSCC)/libdep.mk
-OBJ = scc.o
-HDR = config.h \
- $(PROJECTDIR)/inc/scc.h \
- $(PROJECTDIR)/inc/arg.h \
- $(PROJECTDIR)/inc/syscrts.h \
- $(PROJECTDIR)/inc/sysincludes.h \
- $(PROJECTDIR)/inc/syslibs.h \
- $(PROJECTDIR)/inc/ldflags.h
-
all: scc cpp
- mkdir -p $(PROJECTDIR)/rootdir/bin
cp scc cpp $(PROJECTDIR)/rootdir/bin/
-dep:
- PREFIX=$(PREFIX) USEQBE=$(USEQBE) ./gendep.sh $(TARGETS)
+scc: scc.o $(LIBSCC)/libscc.a
+ $(CC) $(SCC_LDFLAGS) scc.o -lscc -o $@
-$(OBJ): $(HDR)
-
-scc: $(OBJ) $(LIBDIR)/libscc.a
- $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
-
cpp: cpp.sh config.h
set -x ;\
trap "rm -f $$$$.sh" 0 2 3;\
@@ -34,11 +18,14 @@
chmod +x $$$$.sh && \
mv $$$$.sh $@
+dep:
+ PREFIX=$(PREFIX) USEQBE=$(USEQBE) ./config.sh $(TARGETS)
+ $(PROJECTDIR)/mkdep.sh
+
clean:
- rm -f $(OBJ)
- rm -f scc
- rm -f scpp
+ rm -f scc scpp *.o
distclean:
rm -f config.h
+include deps.mk
--- /dev/null
+++ b/driver/posix/config.sh
@@ -1,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+rm -f config.h
+trap "rm -f $$.h" 0 2 3
+
+PREFIX=${PREFIX-$HOME}
+USEQBE=${USEQBE:-1}
+
+echo $@ |
+(IFS='- ' read arch abi sys format r
+echo \#define PREFIX \"$PREFIX\"
+echo \#define USEQBE $USEQBE
+echo \#define ARCH \"$arch\"
+echo \#define SYS \"$sys\"
+echo \#define ABI \"$abi\"
+echo \#define FORMAT \"$format\") > $$.h && mv $$.h config.h
--- /dev/null
+++ b/driver/posix/deps.mk
@@ -1,0 +1,8 @@
+#deps
+scc.o: ./../../inc/arg.h
+scc.o: ./../../inc/ldflags.h
+scc.o: ./../../inc/scc.h
+scc.o: ./../../inc/syscrts.h
+scc.o: ./../../inc/sysincludes.h
+scc.o: ./../../inc/syslibs.h
+scc.o: ./config.h
--- a/driver/posix/gendep.sh
+++ /dev/null
@@ -1,18 +1,0 @@
-#!/bin/sh
-
-set -e
-
-rm -f config.h
-trap "rm -f $$.h" 0 2 3
-
-PREFIX=${PREFIX-$HOME}
-USEQBE=${USEQBE:-1}
-
-echo $@ |
-(IFS='- ' read arch abi sys format r
-echo \#define PREFIX \"$PREFIX\"
-echo \#define USEQBE $USEQBE
-echo \#define ARCH \"$arch\"
-echo \#define SYS \"$sys\"
-echo \#define ABI \"$abi\"
-echo \#define FORMAT \"$format\") > $$.h && mv $$.h config.h