aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-10-04 10:19:06 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-10-04 10:19:06 -0700
commit40133b212b38082200e0cdda7baa8b89b7ff6801 (patch)
treec085a861cfaf9df96a82eaf8b09f40c4edf1d8b9
parenta548569a3e833a86d80e5a29f5a1bf183754e40c (diff)
downloadtftp-hpa-40133b212b38082200e0cdda7baa8b89b7ff6801.tar.gz
Move common code to a common/ subdirectory
-rw-r--r--MCONFIG.in4
-rw-r--r--Makefile2
-rw-r--r--common/Makefile25
-rw-r--r--common/tftpsubs.c (renamed from tftp/tftpsubs.c)0
-rw-r--r--common/tftpsubs.h (renamed from tftp/tftpsubs.h)0
-rw-r--r--tftp/Makefile4
-rw-r--r--tftp/main.c2
-rw-r--r--tftp/tftp.c2
-rw-r--r--tftpd/Makefile10
-rw-r--r--tftpd/recvfrom.c2
-rw-r--r--tftpd/tftpd.c2
11 files changed, 36 insertions, 17 deletions
diff --git a/MCONFIG.in b/MCONFIG.in
index 5788e81..35e9af5 100644
--- a/MCONFIG.in
+++ b/MCONFIG.in
@@ -55,8 +55,8 @@ CFLAGS = @CFLAGS@ -I$(SRCROOT)
LDFLAGS = @LDFLAGS@
# Libraries (client and server)
-TFTP_LIBS = @TFTP_LIBS@
-TFTPD_LIBS = @TFTPD_LIBS@
+TFTP_LIBS = ../common/libcommon.a @TFTP_LIBS@
+TFTPD_LIBS = ../common/libcommon.a @TFTPD_LIBS@
# Additional library we need to build
LIBOBJS = @LIBOBJS@
diff --git a/Makefile b/Makefile
index 0c73fcf..8f78839 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
# You can do "make SUB=blah" to make only a few, or edit here, or both
# You can also run make directly in the subdirs you want.
-SUB = lib tftp tftpd
+SUB = lib common tftp tftpd
%.build: MCONFIG aconfig.h version.h
$(MAKE) -C $(patsubst %.build, %, $@)
diff --git a/common/Makefile b/common/Makefile
new file mode 100644
index 0000000..a825213
--- /dev/null
+++ b/common/Makefile
@@ -0,0 +1,25 @@
+SRCROOT = ..
+VERSION = $(shell cat ../version)
+
+-include ../MCONFIG
+include ../MRULES
+
+OBJS = tftpsubs.$(O)
+LIB = libcommon.a
+
+all: $(LIB)
+
+$(LIB): $(OBJS)
+ -rm -f $(LIB)
+ $(AR) $(LIB) $(OBJS)
+ $(RANLIB) $(LIB)
+
+$(OBJS): tftpsubs.h
+
+install:
+
+clean:
+ rm -f *.o *.obj *.exe $(LIB)
+
+distclean: clean
+ rm -f *~
diff --git a/tftp/tftpsubs.c b/common/tftpsubs.c
index 3dd34bd..3dd34bd 100644
--- a/tftp/tftpsubs.c
+++ b/common/tftpsubs.c
diff --git a/tftp/tftpsubs.h b/common/tftpsubs.h
index 645c6b9..645c6b9 100644
--- a/tftp/tftpsubs.h
+++ b/common/tftpsubs.h
diff --git a/tftp/Makefile b/tftp/Makefile
index 0ff0451..20f4c18 100644
--- a/tftp/Makefile
+++ b/tftp/Makefile
@@ -4,14 +4,14 @@ VERSION = $(shell cat ../version)
-include ../MCONFIG
include ../MRULES
-OBJS = tftp.$(O) main.$(O) tftpsubs.$(O)
+OBJS = tftp.$(O) main.$(O)
all: tftp$(X) tftp.1
tftp$(X): $(OBJS)
$(CC) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@
-$(OBJS): tftpsubs.h
+$(OBJS): ../common/tftpsubs.h
tftp.1: tftp.1.in ../version
sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
diff --git a/tftp/main.c b/tftp/main.c
index 961c0c4..f58cf45 100644
--- a/tftp/main.c
+++ b/tftp/main.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*/
-#include "tftpsubs.h"
+#include "common/tftpsubs.h"
#ifndef lint
static const char *copyright UNUSED =
diff --git a/tftp/tftp.c b/tftp/tftp.c
index 475d25b..97b10dc 100644
--- a/tftp/tftp.c
+++ b/tftp/tftp.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
-#include "tftpsubs.h"
+#include "common/tftpsubs.h"
#ifndef lint
/* static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93"; */
diff --git a/tftpd/Makefile b/tftpd/Makefile
index 0729a26..a05335d 100644
--- a/tftpd/Makefile
+++ b/tftpd/Makefile
@@ -4,20 +4,14 @@ VERSION = $(shell cat ../version)
-include ../MCONFIG
include ../MRULES
-OBJS = tftpd.$(O) tftpsubs.$(O) recvfrom.$(O) misc.$(O) $(TFTPDOBJS)
+OBJS = tftpd.$(O) recvfrom.$(O) misc.$(O) $(TFTPDOBJS)
all: tftpd$(X) tftpd.8
tftpd$(X): $(OBJS)
$(CC) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@
-tftpsubs.c:
- $(LN_S) -f ../tftp/tftpsubs.c .
-
-tftpsubs.h:
- $(LN_S) -f ../tftp/tftpsubs.h .
-
-$(OBJS): tftpsubs.h
+$(OBJS): ../common/tftpsubs.h
tftpd.8: tftpd.8.in ../version
sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
diff --git a/tftpd/recvfrom.c b/tftpd/recvfrom.c
index 22440ce..0b3456e 100644
--- a/tftpd/recvfrom.c
+++ b/tftpd/recvfrom.c
@@ -19,7 +19,7 @@
#include "config.h" /* Must be included first! */
#include "recvfrom.h"
-#include "tftpsubs.h"
+#include "common/tftpsubs.h"
#ifdef HAVE_MACHINE_PARAM_H
#include <machine/param.h> /* Needed on some versions of FreeBSD */
#endif
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
index 24fe904..47b85d9 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
@@ -62,7 +62,7 @@ static const char *rcsid UNUSED =
#include <limits.h>
#include <syslog.h>
-#include "tftpsubs.h"
+#include "common/tftpsubs.h"
#include "recvfrom.h"
#include "remap.h"