31 lines
676 B
Makefile
31 lines
676 B
Makefile
SRCd := src
|
|
BINd := bin
|
|
OBJd := obj
|
|
INCd := inc
|
|
CC = gcc
|
|
LDFLAGS =
|
|
CFLAGS = -Iinclude -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)
|
|
|
|
$(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: all clean |