Skip to content

Instantly share code, notes, and snippets.

@mitbailey
Created April 28, 2022 16:17
Show Gist options
  • Save mitbailey/748a1f0fb6ef7b9f3ba1fd45f3aed805 to your computer and use it in GitHub Desktop.
Save mitbailey/748a1f0fb6ef7b9f3ba1fd45f3aed805 to your computer and use it in GitHub Desktop.
CC = gcc
COBJS = src/main.o src/example.o drivers/driver.o
EDCFLAGS = -I ./ -I ./include/ -Wall -pthread $(CFLAGS)
EDLDFLAGS := -lpthread -lm $(LDFLAGS)
TARGET = example.out
all: $(COBJS)
$(CC) $(EDCFLAGS) $(COBJS) -o $(TARGET) $(EDLDFLAGS)
sudo ./$(TARGET)
%.o: %.c
$(CC) $(EDCFLAGS) -o $@ -c $<
.PHONY: clean
clean:
$(RM) *.out
$(RM) *.o
$(RM) src/*.o
.PHONY: spotless
spotless:
$(RM) drivers/*.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment