I need to write a simple make file for my.c, and so after
make
then my program can be run by
./my
Just a minor correction: put the -lm
to the linking step, and there after all object files.
all: my
my: cJ.o my.o
gcc cJ.o my.o -o my -lcrypt -lm
cJ.o: cJ/cJ.c
gcc -c cJ/cJ.c
my.o: my.c
gcc -c my.c
And then, you could work more with automatic variables:
all: my
my: cJ.o my.o
gcc $^ -o $@ -lcrypt -lm
cJ.o: cJ/cJ.c
gcc -c $^
my.o: my.c
gcc -c $^
where $@
is the target of the current rule and $^
are the prerequisites.
See also http://www.gnu.org/software/make/manual/make.html.