Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: What Makefiles do

by Firefly258 (Beadle)
on Nov 09, 2006 at 03:14 UTC ( [id://583036] : note . print w/replies, xml ) Need Help??


in reply to What Makefiles do

I thought knew what make and Makefiles do for C and C++ projects check source file dependencies and binary files, seeing what needs to be recompiled.

I think you meant "compiled" up there not "recompiled". Makefiles are similar to shell scripts, a series of instructions for the machine-local copy of make to process for different stages of preprocessing, compiling and installing packages from source. And the very same applies to perl modules too.

You have to remember that perl is a high level language whose capabilities transcend the different non-portable languages built for dedicated platforms and architectures (like C, C++, etc). This makes perl really powerful and portable but at a cost, the layer of abstraction at which perl operates doesn't allow a perl user to directly access the system, create data structures using the fundamental data types, interact with hardware and external libraries, etc. One of the ways perl modules get to work identically across the various host environments is to initially build a "platform" (for lack of a better word) that is dependant on the machine's subtleties - C compilers, fundamental data-types, endianness, memory management algorithms, available libraries, paths, etc, etc. So it is the job of makefiles (in perl too) to analyze the system, create rules, compile C code (in XS/SWIG) and install the compiled binaries into the perl path (@INC), etc. The importance of the makefile in a perl module varies - some perl modules contain very little perl code and are largely comprised of compiled XS, other's contain pure perl and little or no XS.