Last active
January 1, 2019 21:56
-
-
Save activedecay/78d05a50cf13465819257e87a6124072 to your computer and use it in GitHub Desktop.
god-like makefile, thanks Beta
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
# c | |
# ├── Makefile | |
# ├── obj | |
# └── src | |
# ├── lib.c | |
# ├── lib.h | |
# └── server.c | |
EXE := doit | |
SRC := src | |
OBJ := obj | |
SOURCES := $(wildcard $(SRC)/*.c) | |
OBJECTS := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES)) | |
.PHONY: all clean | |
all: $(EXE) | |
$(EXE): $(OBJECTS) | |
$(CC) $^ -o $@ | |
$(OBJ)/%.o: $(SRC)/%.c | |
$(CC) -I$(SRC) -c $< -o $@ | |
clean: $(EXE) $(OBJECTS) | |
rm $^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/a/40621556/823282 i fucking love you bro