Difference between revisions of "Make"

From Computer Science
Jump to: navigation, search
(Make)
Line 1: Line 1:
GNU Make...
+
This page will be filled in with information about GNU Make. Some places where you can get documentation and information are the following:
 
+
* https://www.gnu.org/software/make/
https://www.gnu.org/software/make/
+
* https://linux.die.net/man/1/make
 
+
* https://www.gnu.org/software/make/manual/html_node/Quick-Reference.html
https://linux.die.net/man/1/make
 
 
 
https://www.gnu.org/software/make/manual/html_node/Quick-Reference.html
 
  
 +
The following can be used as a default Makefile for C. This will take all .c files and compile them into .o. You would create a file with the filename Makefile in the directory, and then when you want to compile all of the files you type <code>make</code> in the terminal. If you want to remove all of the .o files you would type <code>make clean</code> in the terminal.
 
<pre>
 
<pre>
 
SHELL = /bin/sh
 
SHELL = /bin/sh
CFLAGS = -g -Wall -O0
+
CFLAGS = -g -Wall -O0 -lm
 
SRCS = $(wildcard *.c)
 
SRCS = $(wildcard *.c)
 
OBJS = $(SRCS:.c=.o)
 
OBJS = $(SRCS:.c=.o)

Revision as of 12:39, 24 August 2023

This page will be filled in with information about GNU Make. Some places where you can get documentation and information are the following:

The following can be used as a default Makefile for C. This will take all .c files and compile them into .o. You would create a file with the filename Makefile in the directory, and then when you want to compile all of the files you type make in the terminal. If you want to remove all of the .o files you would type make clean in the terminal.

SHELL = /bin/sh
CFLAGS = -g -Wall -O0 -lm
SRCS = $(wildcard *.c)
OBJS = $(SRCS:.c=.o)

all: $(OBJS)

%.o : %.c
        gcc $(CFLAGS) $< -o $@

clean:
        rm -f *.o