Last active
January 20, 2025 01:38
-
-
Save disconnect3d/fba8310068a7a6cab221145f8a8fab62 to your computer and use it in GitHub Desktop.
Minimal & universal makefile for C language
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=-Wall -Wextra -Wpedantic | |
LDFLAGS= | |
SOURCES=$(wildcard *.c ) | |
OBJECTS=$(SOURCES:.c=.o) | |
EXECUTABLE=exec | |
all: $(EXECUTABLE) | |
./$(EXECUTABLE) | |
$(EXECUTABLE): $(OBJECTS) | |
$(CC) $(CFLAGS) $(OBJECTS) -o $(EXECUTABLE) | |
$(OBJECTS): $(SOURCES) | |
$(CC) $(CFLAGS) -c $< -o $@ | |
clean: | |
rm $(EXECUTABLE) $(OBJECTS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perfect!