makefile

cimon's Avatar, Join Date: Feb 2007
Go4Expert Member
hello

I am not sure if i am posting my query in the rt forum section.

Ok ..i wanted to know how to make makefile for my C programs in windows.
Pls help
Thank you
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You have posted it in the right forum but in the wrong section. I have moved your query as an article to the forums for discussion.

You can use the export make file function in the MS compiler and see what it contains and then use it to your needs and modify as needed.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
The same is true if your compiler happens to be Dev-Cpp (an IDE which uses Mingw).
0
cimon's Avatar, Join Date: Feb 2007
Go4Expert Member
Hello

I dont have a MS compiler.
I have Turbo C 2.0

Can u pls tell...how to make a makefile in this one.......
i wanted to try out and execute an online code which is accompanied with its makefile but it is not executing on windows........here is the makefile that was also available online


CFLAGS=-g -I.
LFLAGS=

facetrain: facetrain.o imagenet.o backprop_initr.o pgmimage.o
$(CC) ${LFLAGS} facetrain.o imagenet.o backprop_initr.o pgmimage.o \
-o facetrain -lm

hidtopgm: hidtopgm.o pgmimage.o backprop_initr.o
$(CC) ${LFLAGS} hidtopgm.o pgmimage.o backprop_initr.o \
-o hidtopgm -lm

outtopgm: outtopgm.o pgmimage.o backprop_initr.o
$(CC) ${LFLAGS} outtopgm.o pgmimage.o backprop_initr.o \
-o outtopgm -lm

facetrain_init0: facetrain.o imagenet.o backprop_init0.o pgmimage.o
$(CC) ${LFLAGS} facetrain.o imagenet.o backprop_init0.o pgmimage.o \
-o facetrain_init0 -lm

backprop_initr.o: backprop.c backprop.h
$(CC) ${CFLAGS} -c backprop.c
mv backprop.o backprop_initr.o

backprop_init0.o: backprop.c backprop.h
$(CC) ${CFLAGS} -c -DINITZERO backprop.c
mv backprop.o backprop_init0.o

--------------------------------------------------------
Now i also have these files mentioned in makefile........
Now how to make it work on windows.

Pls help
0
cimon's Avatar, Join Date: Feb 2007
Go4Expert Member
And as you mentioned dev C++

I have installed dev C++...but not able to even compile the files...
the files were compiling in turbo c

I created a project named code and added all these 8 files in it.........but on executing it gives e a build error
C:\Dev-Cpp\Makefile.win [Build Error] [code.exe] Error 1
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
You should use a modern compiler. It is entirely possible that code written in the heydey of Turbo C 2.0 won't run on a modern machine. For instance, modern desktop machines, whether Windows or *nix or something else, run in a protected mode that ordinarily prevents one from accessing all memory freely, or from accessing I/O ports. Old Borland code for graphics operations, for instance, has to be rewritten. How it has to be rewritten is entirely platform- and OS-dependent. The fact that Turbo C will compile without complaining only means that Turbo C is non-compliant, or that it is not written for the current state of the platform.

Messing with a makefile is not going to solve these problems. Once you have working code, then the makefile thing is just another learning step.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Also TC 2 and 3 used clrscr function which cannot be used in some modern day compilers.

Also I am not sure if there is a way to use the makefiles for turboC2 because as far as I remember my good old college days it did not had the concept of projects / workspace