Created
April 19, 2017 20:22
-
-
Save arjkb/aa1c73aca3d9add77630d9f819413232 to your computer and use it in GitHub Desktop.
Makefile for graph-coloring project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS=-g | |
OBJS=greedy.o random.o randomgraph.o sig.o | |
all: greedy random randomgraph sig | |
greedy: greedy.o | |
$(CC) $(CFLAGS) -o greedy greedy.o | |
random: random.o | |
$(CC) $(CFLAGS) -o random random.o | |
randomgraph: randomgraph.o | |
$(CC) $(CFLAGS) -o randomgraph randomgraph.o | |
sig: sig.o | |
$(CC) $(CFLAGS) -o sig sig.o | |
greedy.o: greedy.c | |
$(CC) -c $(CFLAGS) greedy.c | |
greedy.o: greedy.c | |
$(CC) -c $(CFLAGS) greedy.c | |
greedy.o: greedy.c | |
$(CC) -c $(CFLAGS) greedy.c | |
greedy.o: greedy.c | |
$(CC) -c $(CFLAGS) greedy.c | |
.PHONY: clean | |
clean: | |
rm greedy random randomgraph sig *.o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Easiest way to get started is to click on
RAW
and save the Makefie in the directory that contains the rest of the.c
files.The following would work on Linux or Mac.
To compile all C sources and create their executables, run:
To compile a specific C file, run
make filename
(filename
specified here should NOT have .c extension).For instance, to create the executable for
greedy.c
, run:To remove all object files and executables, run:
To run the executable, type
./executable
.For instance, to run the executable for
greedy.c
(which you get after runningmake greedy
or justmake
), run: