From 23f1b1aba15d36c519d2183b98c02add7a599050 Mon Sep 17 00:00:00 2001 From: crs Date: Sat, 6 Oct 2001 14:18:01 +0000 Subject: [PATCH] updated old files to new implementation --- Make-linux | 91 ++++++++++++++++-------------------------------------- Makefile | 69 ++++++++++++++++++++++++++++------------- 2 files changed, 74 insertions(+), 86 deletions(-) diff --git a/Make-linux b/Make-linux index e78e2da4..c64314b5 100644 --- a/Make-linux +++ b/Make-linux @@ -1,12 +1,10 @@ -# -# empty define, used to terminate lists -# -NULL = - # # build tools # +AR = /usr/bin/ar cru +CD = cd CXX = /usr/bin/g++ +ECHO = echo LD = /usr/bin/ld MKDIR = /bin/mkdir RM = /bin/rm -f @@ -15,12 +13,8 @@ RMR = /bin/rm -rf # # compiler options # -CXXFLAGS = $(LCXXFLAGS) $(GCXXFLAGS) $(CXXOPTIMIZER) $(MKDEPOPT) -LCXXFLAGS = $(LCXXDEFS) $(LCXXINCS) $(LCXXOPTS) -GCXXFLAGS = $(GCXXDEFS) $(GCXXINCS) $(GCXXOPTS) - -GCXXDEFS = -D_POSIX_SOURCE -GCXXINCS = -I$(DEPTH)/include -I/usr/include -I/usr/X11R6/include +GCXXDEFS = -D_POSIX_C_SOURCE=199309 +GCXXINCS = -I$(DEPTH)/include -I/usr/X11R6/include GCXXOPTS = -Wall -W -fexceptions -fno-rtti CXXOPTIMIZER = -g #CXXOPTIMIZER = -O2 -DNDEBUG @@ -28,12 +22,13 @@ CXXOPTIMIZER = -g # # linker options # -LDFLAGS = $(LDOPTS) $(LDLIBS) -LDOPTS = $(LLDOPTS) $(GLDOPTS) -LDLIBS = $(LLDLIBS) $(GLDLIBS) - GLDLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXtst -GLDOPTS = +GLDOPTS = -L$(LIBDIR) + +# +# library stuff +# +LIBTARGET = $(LIBDIR)/lib$(TARGET).a # # dependency generation stuff @@ -44,12 +39,6 @@ MKDEPPRE = MKDEPPOST = $(MKDEP) -f $(MKDEPFILE) $*.d; $(RM) $*.d MKDEPFILE = Makedepend -# -# Convenience file list macros: -# -SOURCES = $(CXXFILES) -OBJECTS = $(CXXFILES:.cpp=.o) - # # stuff to clean # @@ -57,47 +46,21 @@ DIRT = $(_FORCE) $(LDIRT) $(GDIRT) GDIRT = *.[eoud] a.out core ar.tmp.* $(MKDEPFILE) # -# always unsatisfied target +# Rule macros for nonterminal makefiles that iterate over subdirectories, +# making the current target. Set SUBDIRS to the relevant list of kids. # -_FORCE = $(COMMONPREF)_force +# Set NOSUBMESG to any value to suppress a warning that subdirectories +# are not present. +# +SUBDIR_MAKERULE= \ + if test ! -d $$d; then \ + if test "$(NOSUBMESG)" = "" ; then \ + ${ECHO} "SKIPPING $$d: No such directory."; \ + fi \ + else \ + ${ECHO} "${CD} $$d; $(MAKE) $${RULE:=$@}"; \ + (${CD} $$d; ${MAKE} $${RULE:=$@}); \ + fi -# -# -# common rules -# -# - -# -# default target. makefiles must define a target named `targets'. -# -default: targets - -# -# always unsatisfied target -# -$(_FORCE): - -# -# cleaners -# -COMMONTARGETS = clean clobber -$(COMMONPREF)clean: $(_FORCE) - $(RM) $(DIRT) - -$(COMMONPREF)clobber: clean $(_FORCE) - $(RM) $(TARGETS) - -# -# implicit target rules -# -.SUFFIXES: .cpp .o - -.cpp.o: - $(MKDEPPRE) - $(CXX) $(CXXFLAGS) -c $< - $(MKDEPPOST) - -# -# load dependencies -# -sinclude $(MKDEPFILE) +SUBDIRS_MAKERULE= \ + @for d in $(SUBDIRS); do $(SUBDIR_MAKERULE); done diff --git a/Makefile b/Makefile index f8384949..d3ee18df 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,63 @@ DEPTH=. -include Make-linux +COMMONPREF = root +include Makecommon # -# target files +# subdirectories +# +SUBDIRS = \ + base \ + mt \ + io \ + net \ + $(NULL) +# +# targets +# + +default: $(COMMONPREF)_force + $(SUBDIRS_MAKERULE) + +all targets: default + +clean: + $(RMR) $(LIBDIR) + $(SUBDIRS_MAKERULE) + +clobber: + $(RMR) $(LIBDIR) + $(SUBDIRS_MAKERULE) + +# +# +# test +# # -TARGETS = main # # source files # -CXXFILES = \ - XBase.cpp \ - CTrace.cpp \ - CEventQueue.cpp \ - CSocket.cpp \ - CMessageSocket.cpp \ - CSocketFactory.cpp \ - CServer.cpp \ - CClient.cpp \ - CScreenProxy.cpp \ - CXScreen.cpp \ - CUnixXScreen.cpp \ - CUnixTCPSocket.cpp \ - CUnixEventQueue.cpp \ - main.cpp \ +LCXXINCS = \ + -I$(DEPTH)/base \ + -I$(DEPTH)/mt \ + -I$(DEPTH)/io \ + -I$(DEPTH)/net \ $(NULL) +CXXFILES = test.cpp # # libraries we depend on # -DEPLIBS = \ +DEPLIBS = \ + $(LIBDIR)/libnet.a \ + $(LIBDIR)/libio.a \ + $(LIBDIR)/libmt.a \ + $(LIBDIR)/libbase.a \ + $(NULL) +LLDLIBS = \ + $(DEPLIBS) \ + -lpthread \ $(NULL) -targets: $(TARGETS) - -main: $(OBJECTS) $(DEPLIBS) +test: $(OBJECTS) $(DEPLIBS) $(CXX) $(CXXFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)