Created
November 12, 2023 11:37
-
-
Save 0xdeadbeer/64fe68bab648723498ccabe558878ec7 to your computer and use it in GitHub Desktop.
Example Makefile
This file contains hidden or 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= | |
LDFLAGS= | |
TARGET=project | |
SDIR=src | |
ODIR=build | |
SRC=$(shell find $(SDIR) -type f -name *.c) | |
OBJ=$(SRC:.c=.o) | |
all: $(TARGET) | |
.PHONY: default | |
$(TARGET): $(OBJ) | |
mkdir -p build | |
$(CC) -o $(ODIR)/$@ $^ $(LDFLAGS) | |
%.o: %.c | |
$(CC) $(CFLAGS) -o $@ -c $< | |
.PHONY: clean | |
clean: | |
rm -f $(ODIR)/$(TARGET) $(OBJ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment