#!/bin/bash

# This is an example program which compiles a binary file 2 different ways
# 1) Compile all modules into object files and then store them into archives
# to be used in the linking process
# 2) Directly compile the object files into the main program.
# They both will produce the exact same results and no difference in the
# file should be encountered
# By j00n1x (c) 2003

# compile to object file only
gcc -c func.c -o func.o

# add object file into 'archive' .a file (static library)
rm -f libmoo.a
ar -q libmoo.a func.o


# compile and link test.c with our static library!
gcc test.c -L. -lmoo -o test1

# of course, this is just pretentious BS which can be shortened:
gcc test.c func.o -o test2

# This proves that .a files are no better than .o files. But are just,
# simply, 'archives' that can be used by gcc (actually ld). 
diff test1 test2


