I am reading a book on programming in C.
It is getting into working on larger projects and showed how to make a simple little makefile.
I have never used a makefile before and the book is a little old.. it is from 1999 so I want to make sure I am doing everything right.
In terminal I type:Code:File: makefile.gcc #-------------------------------------------------# # Makefile for Unix systems # # Using a GNU C compiler # #-------------------------------------------------# CC=gcc CFLAGS=-g -D__USE_FIXED_PROTOTYPES__ -ansi # # Compiler flags: # -g -- Enable debugging # -Wall -- Turn on all warnings # -D__USE_FIXED_PROTOTYPES__ # -- Force the compiler to use the correct headers # -ansi -- Don't use GNU extensions. Stick to ANSI C. 7-1: 7-1.c $(CC) $(CFLAGS) -o output 7-1.c clean: rm -f output
Is this makefile workable? I compiled the program before making the makefile with gcc so I don't think makefile will do it again.Code:$ make -f makefile.gcc gcc -g -D__USE_FIXED_PROTOTYPES__ -ansi -o output 7-1.c $



Adv Reply



Bookmarks