PowBuild

What Is It?

A build/make system that uses clean elegant FPC programs. It is similar to fpmake. PowBuild was started since:
  • GNU make and FPCMake style files are atrocious, not as powerful. Make files become gigantic unmaintainable messes
  • fpmake was an interesting idea but but didn't serve all our automation needs.
  • make tools seem to require you manually keep track of which files to compile. Where is the automation in that? With PowBuild you can grab a wild card of *.PAS files, *.DPR files, etc. and compile them in one shot - without manually keeping track of all your files.
  • PowBuild creates a ".crap" directory for all annoying .PPU/.A/.DCU style binary unit files that normally get in your way.
  • clean, rebuild (with clean first), and other flags available
  • customize build groups (known as "targets" in other make systems)
  • Learn to use our wildcard directory/file utilities and you can do several compilations of several files without manually tracking files. For example, other make systems won't let you compile a wildcard of all *.dpr files in some directories easily.. they require you manually keep track of individual projects... very silly! PowBuild is based on automation and is for saving time.

Example Build File

program build; {$mode objfpc}{$H+}
{ This program would build some demo programs (.dpr) without you manually 
  having to whitelist each .dpr file to build! }
uses pwtypes, pwdirutil, pwbuildutil;

// names of the groups we offer to build, you can add more in the array
type NameCount = (nExamples {, more go here});
const 
  names: array [NameCount] of str15 = ('examples' {, more here});

procedure Build;
var g: TGroup; 
    curgroup: astr; 
    Paths: TPaths;
begin
  Init(g);
  g.SmartStrip:= true;
  AddUnitPath(g, '../main/');
  AddUnitPath(g, 'your/folder/');
  AddDefine(g, 'SOME_DEFINE');  
  { get all .DPR files to compile from subdirectories in examples folder }
  GetDirFiles('examples/', '*.dpr', Paths);
  if Paths.count < 1 then HaltErr('Could not find *.DPR files in subdirs');
  { setup "examples" group }
  curgroup:= names[nExamples];
  if (doingAll) or (doingDefault) or (group = curgroup) then begin
    g.Name:= curgroup; 
    g.ProgBinDir:= 'bin'; { folder for Exe/Elf program to end up }
    CreateGroup(g, Paths);
  end;
  { run the build }
  Run();
end;

begin
  { set visible groups to show at the command prompt help, for users to see }
  SetVisibleGroups(names);
  Build;
end.

Download

Currently, pwbuildutil.pas and PowBuild example build scripts (actually programs) exist on SVN.


Copyright © Powtils