Created
August 16, 2021 18:08
-
-
Save erfg12/6d6852df7d69e589f308371d2cc0b9af to your computer and use it in GitHub Desktop.
C GCC makefile
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
# [Windows] Install MinGW (https://sourceforge.net/projects/mingw), add C:\MinGW\bin to Environment Variables PATH. Run command mingw32-make | |
# [MacOS] https://discussions.apple.com/thread/5250041 | |
# [Ubuntu] "sudo apt install build-essential" | |
EXECUTABLE = main | |
CC = "gcc" | |
LDFLAGS = -lgdi32 | |
src = $(wildcard *.c) | |
obj = $(src:.c=.o) | |
all: myprog | |
myprog: $(obj) | |
$(CC) -o $(EXECUTABLE) $^ $(LDFLAGS) | |
.PHONY: clean | |
clean: | |
del $(obj) $(EXECUTABLE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment