Makefile (1026B)
1 # GNU Makefile for Game of Life simulation 2 # 3 # Usage: make [-f path\Makefile] [DEBUG=Y] target 4 5 NAME = stamd 6 CC = gcc 7 8 CFLAGS = -Iinclude 9 LDFLAGS += -lmd4c-html 10 11 SRC = src 12 OBJ = obj 13 BINDIR = bin 14 15 BIN = bin/$(NAME) 16 SRCS=$(wildcard $(SRC)/*.c) 17 OBJS=$(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SRCS)) 18 19 ifeq ($(DEBUG),Y) 20 CFLAGS += -lciid 21 CFLAGS += -Wall -ggdb 22 else 23 CFLAGS += -lcii 24 endif 25 26 all: $(BIN) 27 28 $(BIN): $(OBJS) 29 $(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@ 30 31 $(OBJ)/%.o: $(SRC)/%.c 32 $(CC) -c $< -o $@ $(CFLAGS) $(LDFLAGS) 33 34 clean: 35 -$(RM) $(BIN) $(OBJS) 36 37 help: 38 @echo "Stamd - Static Markdown Page Generator" 39 @echo 40 @echo "Usage: make [-f path\Makefile] [DEBUG=Y] target" 41 @echo 42 @echo "Target rules:" 43 @echo " all - Compiles binary file [Default]" 44 @echo " clean - Clean the project by removing binaries" 45 @echo " help - Prints a help message with target rules" 46 @echo 47 @echo "Optional parameters:" 48 @echo " DEBUG - Compile binary file with debug flags enabled" 49 @echo 50 51 .PHONY: all clean help docs