gol

Implementation of Conway's Game of Life writen in C
git clone git://git.dimitrijedobrota.com/gol.git
Log | Files | Refs | README

commit f22cebbbe089efb4e7b627e2d7bd5acf5409e2df
parent 13229b25c4cd705fee1bccfeb14f626346ffcf42
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Wed, 18 May 2022 20:38:38 +0200

Makefile Windows support

- Makefile has been edited to better utilize the Windows commands and
  allow compiling from CMD, Powershell and Terminal
- Makefile on Linux should work as before
- Makefile now links proper libraries based on the filesystem
- Optional debug flags have been added to bake debugging symbols (normal and GDB) in the executable while developing

Diffstat:
MMakefile | 27+++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,5 +1,11 @@ +CC=gcc CFLAGS = -I include -LDFLAGS = -lncursesw + +ifeq ($(OS),Windows_NT) +LDFLAGS = -lpdcurses +else +LDFLAGS = -lncurses +endif SRC = src OBJ = obj @@ -9,17 +15,22 @@ BIN = bin/gol SRCS=$(wildcard $(SRC)/*.c) OBJS=$(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SRCS)) -CFLAGS +=-ggdb -Wall - -all: ${BIN} +all: $(BIN) +debug: CFLAGS +=-ggdb -Wall +debug: ${BIN} $(BIN): $(OBJS) - ${CC} $^ $(CFLAGS) $(LDFLAGS) -o $@ + $(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ)/%.o: $(SRC)/%.c - ${CC} -c $< -o $@ $(CFLAGS) + $(CC) -c $< -o $@ $(CFLAGS) $(LDFLAGS) +ifeq ($(OS),Windows_NT) +clean: + del bin\gol.exe $(subst /,\,$(OBJS)) +else clean: - rm -r $(BINDIR)/* $(OBJ)/* + rm -f $(BIN) $(OBJS) +endif -.PHONY: all clean +.PHONY: all clean debug