Skip to content

Instantly share code, notes, and snippets.

@kluzny
Created February 7, 2017 19:41
Show Gist options
  • Save kluzny/c1adc44aecdb78798f489fe082abdca0 to your computer and use it in GitHub Desktop.
Save kluzny/c1adc44aecdb78798f489fe082abdca0 to your computer and use it in GitHub Desktop.
cs50 basic makefile using gcc on ubuntu
CC = /usr/bin/gcc
CFLAGS = -g -Wall
LFLAGS = -lcs50
BIN = hello
all: $(BIN)
$(BIN):
$(CC) $(CFLAGS) -o $(BIN) $(BIN).c $(LFLAGS)
clean:
rm -rfv $(BIN)
run:
./$(BIN)
# example usage
# ॐ ~/development/c/helloworld ☠ make
# /usr/bin/gcc -g -Wall -o hello hello.c -lcs50
# ॐ ~/development/c/helloworld ☠ make run
# ./hello
# asdf
# hello, asdf
# ॐ ~/development/c/helloworld ☠ make clean
# rm -rfv hello
# removed 'hello'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment