Perl Script to Generate Makefile

Download here. createmakefile.pdf
# File name:
# Author: A.G.Raja
# Website:
# License: GPL
use strict; use warnings; open(FH,">Makefile") or die "Cannot create Makefile"; print FH ("all: buildnn"); print FH ("build: " . $ARGV[0] .".onn"); print FH ("shared: " . $ARGV[0] . ".sonn"); print FH ("clean: n"); print FH ("trm ".$ARGV[0].".*o nn"); print FH ($ARGV[0].".o: ".$ARGV[0].".cn"); print FH ("tgcc -o ".$ARGV[0].".o ".$ARGV[0].".cnn"); print FH ($ARGV[0].".so: ".$ARGV[0].".cn"); print FH ("tgcc -fPIC -shared -o ".$ARGV[0].".so ".$ARGV[0].".cn"); close FH;
# Usage:
# chmod +x
# hello
Below is the Makefile generated:
all: build build: hello.o shared: clean: rm hello.*o hello.o: hello.c gcc -o hello.o hello.c hello.c gcc -fPIC -shared -o hello.c
Download here. createmakefile.pdf

GCC Include Files Path

GCC looks in several different places for headers.

On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with #include <file> in:

You can add to this list with the -Idir command line option.

Below is a small demo

///////////     defines.c   ////////
#include <stdio.h>
#include <defines.h>
int main()
    return 0;

This requires the folowing header file

///////     headers/defines.h   ///////////
#define begin {
#define end }
//////  save this file in directory named headers

Compile defines.c as below

[raja@AGRAJA ~] gcc defines.c -Iheaders