diff options
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | README.make | 79 | ||||
-rw-r--r-- | apt-pkg/acquire-worker.cc | 3 | ||||
-rw-r--r-- | apt-pkg/algorithms.cc | 3 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 4 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 4 | ||||
-rw-r--r-- | apt-pkg/sourcelist.cc | 4 | ||||
-rw-r--r-- | buildlib/defaults.mak | 13 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 5 |
9 files changed, 101 insertions, 17 deletions
@@ -12,3 +12,6 @@ all headers library clean veryclean binary program doc: $(MAKE) -C deity $@ $(MAKE) -C gui $@ $(MAKE) -C doc $@ + +.PHONY: maintainer-clean dist-clean distclean pristine sanity +maintainer-clean dist-clean distclean pristine sanity: veryclean diff --git a/README.make b/README.make new file mode 100644 index 000000000..bee2d04c3 --- /dev/null +++ b/README.make @@ -0,0 +1,79 @@ +The Make System +~~~ ~~~~ ~~~~~~ +To compile this program you require GNU Make. In fact you probably need +GNU Make 3.76.1 or newer. The makefiles contained make use of many +GNU Make specific features and will not run on other makes. + +The make system has a number of interesting properties that are not found +in other systems such as automake or the GNU makefile standards. In +general some semblance of expectedness is kept so as not to be too +surprising. Basically the following will work as expected: + + ./configure + make + or + cd build + ../configure + make + +There are a number of other things that are possible that may make software +development and software packaging simpler. The first of these is the +environment.mak file. When configure is run it creates an environment.mak +file in the build directory. This contains -all- configurable parameters +for all of the make files in all of the subdirectories. Changing one +of these parameters will have an immediate effect. The use of makefile.in +and configure substitutions across build makefiles is not used at all. + +Furthermore, the make system runs with a current directory equal to the +source directory irregardless of the destination directory. This means +#include "" and #include <> work as epected and more importantly +running 'make' in the source directory will work as expected. The +environment variable or make parameter 'BUILD' sets the build directory. +It may be an absolute path or a path relative to the top level directory. +By default build/ will be used with a fall back to ./ This means +you can get all the advantages of a build directory without having to +cd into it to edit your source code! + +The make system also performs dependency generation on the fly as the +compiler runs. This is extremely fast and accurate. There is however +one failure condition that occures when a header file is erased. In +this case you should run make clean to purge the .o and .d files to +rebuild. + +The final significant deviation from normal make practicies is +in how the build directory is managed. It is not mearly a mirror of +the source directory but is logically divided in the following manner + bin/ + methods/ + doc/ + examples/ + include/ + apt-pkg/ + deity/ + obj/ + apt-pkg/ + deity/ + cmndline/ + [...] +Only .o and .d files are placed in the obj/ subdirectory. The final compiled +binaries are placed in bin, published headers for inter-component linking +are placed in include/ and documentation is generated into doc/. This means +all runnable programs are within the bin/ directory a huge benifit for +debugging inter-program relationships. The .so files are also placed in +bin/ for simplicity. + +Using the makefiles +~~~~~ ~~~ ~~~~~~~~~ +The makefiles for the components are really simple. The complexity is hidden +within the buildlib/ directory. Each makefile defines a set of make variables +for the bit it is going to make then includes a makefile fragment from +the buildlib/. This fragment generates the necessary rules based on the +originally defined variables. This process can be repeated as many times as +necessary for as many programs or libraries as are in the directory. + +Many of the make fragments have some useful properties involving sub +directories and other interesting features. They are more completely +described in the fragment code in buildlib. Some tips on writing fragments +are included in buildlib/defaults.mak + +Jason diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 5bd30b7b1..688c5e220 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: acquire-worker.cc,v 1.2 1998/10/20 02:39:13 jgg Exp $ +// $Id: acquire-worker.cc,v 1.3 1998/10/20 04:33:12 jgg Exp $ /* ###################################################################### Acquire Worker @@ -23,6 +23,7 @@ #include <unistd.h> #include <signal.h> +#include <wait.h> /*}}}*/ // Worker::Worker - Constructor for Queue startup /*{{{*/ diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 755474e15..185e3400e 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: algorithms.cc,v 1.6 1998/10/20 02:39:17 jgg Exp $ +// $Id: algorithms.cc,v 1.7 1998/10/20 04:33:13 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -904,7 +904,6 @@ bool pkgProblemResolver::ResolveByKeep() // Look at all the possible provides on this package pkgCache::Version **VList = End.AllTargets(); - bool Done = false; for (pkgCache::Version **V = VList; *V != 0; V++) { pkgCache::VerIterator Ver(Cache,*V); diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index cc0363da5..bfc674c62 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: fileutl.cc,v 1.9 1998/10/20 02:39:28 jgg Exp $ +// $Id: fileutl.cc,v 1.10 1998/10/20 04:33:16 jgg Exp $ /* ###################################################################### File Utilities @@ -137,7 +137,7 @@ void SetCloseExec(int Fd,bool Close) void SetNonBlock(int Fd,bool Block) { int Flags = fcntl(Fd,F_GETFL); - if (fcntl(Fd,F_SETFL,(Block == false)?0:O_NONBLOCK) != 0) + if (fcntl(Fd,F_SETFL,(Flags & ~O_NONBLOCK) | (Block == false)?0:O_NONBLOCK) != 0) { cerr << "FATAL -> Could not set non-blocking flag " << strerror(errno) << endl; exit(100); diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 13e33dc4f..a73cb410b 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: pkgcache.cc,v 1.11 1998/10/08 05:05:05 jgg Exp $ +// $Id: pkgcache.cc,v 1.12 1998/10/20 04:33:14 jgg Exp $ /* ###################################################################### Package Cache - Accessor code for the cache @@ -346,7 +346,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets() const char *pkgCache::DepIterator::CompType() { const char *Ops[] = {"","<=",">=","<",">","=","!="}; - if ((Dep->CompareOp & 0xF) < sizeof(Ops)) + if ((unsigned)(Dep->CompareOp & 0xF) < sizeof(Ops)) return Ops[Dep->CompareOp & 0xF]; return ""; } diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index e6200d3be..c3fb5642f 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: sourcelist.cc,v 1.7 1998/10/20 02:39:24 jgg Exp $ +// $Id: sourcelist.cc,v 1.8 1998/10/20 04:33:15 jgg Exp $ /* ###################################################################### List of Sources @@ -114,7 +114,7 @@ bool pkgSourceList::Read(string File) debugging. */ ostream &operator <<(ostream &O,pkgSourceList::Item &Itm) { - O << Itm.Type << ' ' << Itm.URI << ' ' << Itm.Dist << ' ' << Itm.Section; + O << (int)Itm.Type << ' ' << Itm.URI << ' ' << Itm.Dist << ' ' << Itm.Section; return O; } /*}}}*/ diff --git a/buildlib/defaults.mak b/buildlib/defaults.mak index c9a501e84..c6a2c15d7 100644 --- a/buildlib/defaults.mak +++ b/buildlib/defaults.mak @@ -30,19 +30,21 @@ # Search for the build directory ifdef BUILD -BUILD_POSSIBLE = $(BUILD) +BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD) else -BUILD_POSSIBLE = $(BASE) $(BASE)/build +BUILD_POSSIBLE := $(BASE) $(BASE)/build endif -BUILD:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak)) -BUILD:= $(patsubst %/,%,$(firstword $(dir $(BUILD)))) +BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*)) +BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX)))) -ifeq ($(words $(BUILD)),0) +ifeq ($(words $(BUILDX)),0) error-all: echo Can't find the build directory in $(BUILD_POSSIBLE) -- use BUILD= endif +override BUILD := $(BUILDX) + # Base definitions INCLUDE := $(BUILD)/include BIN := $(BUILD)/bin @@ -77,6 +79,7 @@ LDFLAGS+= -L$(LIB) # Phony rules. Other things hook these by appending to the dependency # list .PHONY: headers library clean veryclean all binary program doc +.PHONY: maintainer-clean dist-clean distclean pristine sanity all: binary doc binary: library program maintainer-clean dist-clean distclean pristine sanity: veryclean diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 1bf87349b..4f8de001f 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-get.cc,v 1.3 1998/10/19 23:45:36 jgg Exp $ +// $Id: apt-get.cc,v 1.4 1998/10/20 04:33:18 jgg Exp $ /* ###################################################################### apt-get - Cover for dpkg @@ -242,7 +242,7 @@ void ShowEssential(ostream &out,pkgDepCache &Dep) pkgCache::PkgIterator I = Dep.PkgBegin(); string List; bool *Added = new bool[Dep.HeaderP->PackageCount]; - for (int I = 0; I != Dep.HeaderP->PackageCount; I++) + for (unsigned int I = 0; I != Dep.HeaderP->PackageCount; I++) Added[I] = false; for (;I.end() != true; I++) @@ -460,7 +460,6 @@ bool DoUpgrade(CommandLine &CmdL) return false; // Do the upgrade - pkgProblemResolver Resolve(Cache); if (pkgAllUpgrade(Cache) == false) { ShowBroken(c1out,Cache); |