Move common code to a common/ subdirectory

This commit is contained in:
H. Peter Anvin 2006-10-04 10:19:06 -07:00
parent a548569a3e
commit 40133b212b
11 changed files with 36 additions and 17 deletions

View file

@ -55,8 +55,8 @@ CFLAGS = @CFLAGS@ -I$(SRCROOT)
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
# Libraries (client and server) # Libraries (client and server)
TFTP_LIBS = @TFTP_LIBS@ TFTP_LIBS = ../common/libcommon.a @TFTP_LIBS@
TFTPD_LIBS = @TFTPD_LIBS@ TFTPD_LIBS = ../common/libcommon.a @TFTPD_LIBS@
# Additional library we need to build # Additional library we need to build
LIBOBJS = @LIBOBJS@ LIBOBJS = @LIBOBJS@

View file

@ -1,7 +1,7 @@
# You can do "make SUB=blah" to make only a few, or edit here, or both # 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. # 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 %.build: MCONFIG aconfig.h version.h
$(MAKE) -C $(patsubst %.build, %, $@) $(MAKE) -C $(patsubst %.build, %, $@)

25
common/Makefile Normal file
View file

@ -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 *~

View file

@ -4,14 +4,14 @@ VERSION = $(shell cat ../version)
-include ../MCONFIG -include ../MCONFIG
include ../MRULES include ../MRULES
OBJS = tftp.$(O) main.$(O) tftpsubs.$(O) OBJS = tftp.$(O) main.$(O)
all: tftp$(X) tftp.1 all: tftp$(X) tftp.1
tftp$(X): $(OBJS) tftp$(X): $(OBJS)
$(CC) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@ $(CC) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@
$(OBJS): tftpsubs.h $(OBJS): ../common/tftpsubs.h
tftp.1: tftp.1.in ../version tftp.1: tftp.1.in ../version
sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@ sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@

View file

@ -34,7 +34,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "tftpsubs.h" #include "common/tftpsubs.h"
#ifndef lint #ifndef lint
static const char *copyright UNUSED = static const char *copyright UNUSED =

View file

@ -36,7 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include "tftpsubs.h" #include "common/tftpsubs.h"
#ifndef lint #ifndef lint
/* static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93"; */ /* static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93"; */

View file

@ -4,20 +4,14 @@ VERSION = $(shell cat ../version)
-include ../MCONFIG -include ../MCONFIG
include ../MRULES 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 all: tftpd$(X) tftpd.8
tftpd$(X): $(OBJS) tftpd$(X): $(OBJS)
$(CC) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@ $(CC) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@
tftpsubs.c: $(OBJS): ../common/tftpsubs.h
$(LN_S) -f ../tftp/tftpsubs.c .
tftpsubs.h:
$(LN_S) -f ../tftp/tftpsubs.h .
$(OBJS): tftpsubs.h
tftpd.8: tftpd.8.in ../version tftpd.8: tftpd.8.in ../version
sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@ sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@

View file

@ -19,7 +19,7 @@
#include "config.h" /* Must be included first! */ #include "config.h" /* Must be included first! */
#include "recvfrom.h" #include "recvfrom.h"
#include "tftpsubs.h" #include "common/tftpsubs.h"
#ifdef HAVE_MACHINE_PARAM_H #ifdef HAVE_MACHINE_PARAM_H
#include <machine/param.h> /* Needed on some versions of FreeBSD */ #include <machine/param.h> /* Needed on some versions of FreeBSD */
#endif #endif

View file

@ -62,7 +62,7 @@ static const char *rcsid UNUSED =
#include <limits.h> #include <limits.h>
#include <syslog.h> #include <syslog.h>
#include "tftpsubs.h" #include "common/tftpsubs.h"
#include "recvfrom.h" #include "recvfrom.h"
#include "remap.h" #include "remap.h"