# Makefile for the 2014 NRCM phase-field workshop code (PptCodes1D).
# Updated in 2026 so it builds with current compilers. The C sources are unchanged.
#
# Needs a C compiler with OpenMP headers and FFTW 3 (Ubuntu: sudo apt install libfftw3-dev).
# -fcommon: binary.h defines global variables; GCC 10 and later reject that without it.
# If FFTW is installed outside the default paths (for example with Homebrew), add
#   CFLAGS += -I/opt/homebrew/include   and   LDFLAGS += -L/opt/homebrew/lib
#
# Build: make        Run: ./pptg.out        Clean: make clean

CC      = gcc
CFLAGS  = -std=c99 -O3 -fopenmp -fcommon
LDFLAGS =
LDLIBS  = -lfftw3 -lm

# main.c #includes the other .c files, so it is compiled on its own.
pptg.out: main.c get_input.c init_conf.c out_conf.c evolve.c binary.h
	$(CC) $(CFLAGS) -o $@ main.c $(LDFLAGS) $(LDLIBS)

clean:
	rm -f *.o pptg.out

.PHONY: clean
