ref: ea2d5f8dd91f10d96998aedcfbe22f21a9a73d1a
parent: b8e7849bb565bd5195f8232318c14a6d8fb3b599
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Sep 29 12:16:36 EDT 2017
[ar] Separate the not standard part to a different file We already have a DRIVER variable that indicate the host system where we want to run, so it is a good idea to reuse the same variable here.
--- a/ar/Makefile
+++ b/ar/Makefile
@@ -1,8 +1,16 @@
+.POSIX:
+include ../config.mk
+
+OBJ = ar.o $(DRIVER/stat.c
+MOREFLAGS=-I$(DRIVER)
+
all: ar
+ar.o: $(DRIVER)/stat.h
+
dep:
clean:
- rm -f ar
+ rm -f ar *.o $(DRIVER)/*.o
distclean: clean
--- a/ar/ar.c
+++ b/ar/ar.c
@@ -1,12 +1,10 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+#include <stat.h>
int
main(int argc, char *argv[])
--- /dev/null
+++ b/ar/posix/stat.c
@@ -1,0 +1,3 @@
+static char sccsid[] = "@(#) ./ar/stat.c";
+
+#include "stat.h"
--- /dev/null
+++ b/ar/posix/stat.h
@@ -1,0 +1,5 @@
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+