How are the four 8-bit permutation tables of Present cipher calculated?
In short: Trace back where bits come from in every byte in the output state (8 bytes) of the SP_network.

In one round, after we have xored the round key bits, 
we have 8 bytes (a 64 bit word, with rightmost byte 0, leftmost byte 7 etc.
which in the linked software (which is byte oriented) is represented as state[0] to state[7]) are put nibblewise through the S-box: this is easy to do as a byte substitution as well. Then we trace where the bits in the post-permutation state come from (generated by a simple program, here the part for output byte 0, i.e. state[7]:)


bit 0 = byte 0, subbit 0  from byte 0, subbit 0
bit 1 = byte 0, subbit 1  from byte 0, subbit 4
bit 2 = byte 0, subbit 2  from byte 1, subbit 0
bit 3 = byte 0, subbit 3  from byte 1, subbit 4
bit 4 = byte 0, subbit 4  from byte 2, subbit 0
bit 5 = byte 0, subbit 5  from byte 2, subbit 4
bit 6 = byte 0, subbit 6  from byte 3, subbit 0
bit 7 = byte 0, subbit 7  from byte 3, subbit 4


We see that we use the bits 0 of the two S-box nibbles (which are 0 and 5 in the byte) to build a half-nibble (bits 0,1 or bits 2,3 etc.) of an output byte.  So we can start building four byte-indexed tables, say T0,T1,T2,T3 with the constraints that 


T0[b] &amp; 0x03 equals the bits 4,0 from SS[b] (i.e. the double nibble byte S-box.)
T1[b] &amp; 0xc0 equals the bits 4,0 from SS[b] 
T2[b] &amp; 0x30 equals the bits 4,0 from SS[b]
T3[b] &amp; 0xc0 equals the bits 4,0 from SS[b]  


That way we can build up post-permutation byte 0 or state[7] as a bitwise-or 
of masked outputs from these 4 tables (which we want to construct). 

To build up the next to last byte 1 (state[6]) we have the following similar pattern:


bit 8 = byte 1, subbit 0  from byte 4, subbit 0
bit 9 = byte 1, subbit 1  from byte 4, subbit 4
bit 10 = byte 1, subbit 2  from byte 5, subbit 0
bit 11 = byte 1, subbit 3  from byte 5, subbit 4
bit 12 = byte 1, subbit 4  from byte 6, subbit 0
bit 13 = byte 1, subbit 5  from byte 6, subbit 4
bit 14 = byte 1, subbit 6  from byte 7, subbit 0
bit 15 = byte 1, subbit 7  from byte 7, subbit 4


So the same tables can be re-used but on different S-box output bytes.



Next we consider byte 2, state[5], again from the same output: 


bit 16 = byte 2, subbit 0  from byte 0, subbit 1
bit 17 = byte 2, subbit 1  from byte 0, subbit 5
bit 18 = byte 2, subbit 2  from byte 1, subbit 1
bit 19 = byte 2, subbit 3  from byte 1, subbit 5
bit 20 = byte 2, subbit 4  from byte 2, subbit 1
bit 21 = byte 2, subbit 5  from byte 2, subbit 5
bit 22 = byte 2, subbit 6  from byte 3, subbit 1
bit 23 = byte 2, subbit 7  from byte 3, subbit 5


So to build up that byte we need the half-nibble built from the bits 1 of the S-box output (1,5 of the SS-box byte), so the constraints change slightly, where the order of the tables has been changed to get non-contradicting restraints (the lowest bits of T0[b] have already been fixed, etc.), so I use them cyclically:


T1[b] &amp; 0x03 equals the bits 5,1 from SS[b] 
T2[b] &amp; 0x0c equals the bits 5,1 from SS[b] 
T3[b] &amp; 0x30 equals the bits 5,1 from SS[b]
T0[b] &amp; 0xc0 equals the bits 5,1 from SS[b]


The same tables and masks can be re-used for byte 3 (state[4]) as witnessed by


bit 24 = byte 3, subbit 0  from byte 4, subbit 1
bit 25 = byte 3, subbit 1  from byte 4, subbit 5
bit 26 = byte 3, subbit 2  from byte 5, subbit 1
bit 27 = byte 3, subbit 3  from byte 5, subbit 5
bit 28 = byte 3, subbit 4  from byte 6, subbit 1
bit 29 = byte 3, subbit 5  from byte 6, subbit 5
bit 30 = byte 3, subbit 6  from byte 7, subbit 1
bit 31 = byte 3, subbit 7  from byte 7, subbit 5




Thirdly, for byte 4 (and again, similarly 5) we see


bit 32 = byte 4, subbit 0  from byte 0, subbit 2
bit 33 = byte 4, subbit 1  from byte 0, subbit 6
bit 34 = byte 4, subbit 2  from byte 1, subbit 2
bit 35 = byte 4, subbit 3  from byte 1, subbit 6
bit 36 = byte 4, subbit 4  from byte 2, subbit 2
bit 37 = byte 4, subbit 5  from byte 2, subbit 6
bit 38 = byte 4, subbit 6  from byte 3, subbit 2
bit 39 = byte 4, subbit 7  from byte 3, subbit 6


where we build succesive half-nibbles all from the different
masks of the combination of bits 6,2 (bit 2 from a single S-box)
of the SS-box output. So again we can build new constraints, going on cyclically from before:


T2[b] &amp; 0x03 equals the bits 6,2 from SS[b] 
T3[b] &amp; 0x0c equals the bits 6,2 from SS[b] 
T0[b] &amp; 0x30 equals the bits 6,2 from SS[b]
T1[b] &amp; 0xc0 equals the bits 6,2 from SS[b]


where we can re-use the exact same bitwise-or recipe for byte 5.



Finally, for bytes 6 (and 7) we get as the origins:


bit 48 = byte 6, subbit 0  from byte 0, subbit 3
bit 49 = byte 6, subbit 1  from byte 0, subbit 7
bit 50 = byte 6, subbit 2  from byte 1, subbit 3
bit 51 = byte 6, subbit 3  from byte 1, subbit 7
bit 52 = byte 6, subbit 4  from byte 2, subbit 3
bit 53 = byte 6, subbit 5  from byte 2, subbit 7
bit 54 = byte 6, subbit 6  from byte 3, subbit 3
bit 55 = byte 6, subbit 7  from byte 3, subbit 7


So we use the combination of bits 7,3 (or bit 4 from a single S-box)
from different bytes to form this byte. So the next set of new constraints
becomes:


T4[b] &amp; 0x03 equals the bits 7,3 from SS[b] 
T0[b] &amp; 0x0c equals the bits 7,3 from SS[b] 
T1[b] &amp; 0x30 equals the bits 7,3 from SS[b]
T2[b] &amp; 0xc0 equals the bits 7,3 from SS[b]


Now we can gather the results: to actually find T0[b] we 
consider all we know about it from before:


T0[b] &amp; 0x0c equals the bits 7,3 from SS[b]
T0[b] &amp; 0x30 equals the bits 6,2 from SS[b]
T0[b] &amp; 0xc0 equals the bits 5,1 from SS[b]
T0[b] &amp; 0x03 equals the bits 4,0 from SS[b]


and compute the table directly. It will be the table pmt_3 from 
your linked software. This code (gist on GitHub) will compute these combined tables (in a slightly different order I believe then used in the linked software) to see how to do this in more detail.