Fex-II/Makefile
2024-02-22 23:34:30 -06:00

31 lines
753 B
Makefile

SRCd := src
BINd := bin
OBJd := obj
INCd := inc
CC = gcc
LDFLAGS =
CFLAGS = -Iinc -Wall -O2 -g
SRC = $(wildcard $(SRCd)/*.c)
OBJ = $(SRC:$(SRCd)/%.c=$(OBJd)/%.o)
TARGETS = $(SRC:$(SRCd)/%.c=$(BINd)/%)
main: $(OBJ) $(OBJd)/nprint.o # The option of a single program instead of a suite. WARN: Requires modification of source to remove multiple main()
$(CC) $(LDFLAGS) -o $(BINd)/fex $^
multi: $(TARGETS) # Makes a single executable per object instead of congealing them into a single "fex"
$(BINd)/%: $(OBJd)/%.o $(OBJd)/nprint.o
$(CC) $(LDFLAGS) -o $@ $^
$(OBJd)/%.o: $(SRCd)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJd)/nprint.o: $(INCd)/nprint.c $(INCd)/nprint.h
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJd)/*.o $(BINd)/*
.PHONY: main clean