SDL_minesweeper/Makefile

37 lines
712 B
Makefile

# A simple Makefile for compiling small SDL projects
# set the compiler
CC := gcc
# set the compiler flags
CFLAGS := `sdl2-config --libs --cflags` -ggdb3 -O2 --std=c99 -Wall -lSDL2_image -lSDL2_mixer -lm
# add header files here
HDRS := *.h
# add source files here
SRCS := *.c
# generate names of object files
OBJS := $(SRCS:.c=.o)
# name of executable
EXEC := minesweeper
# default recipe
all: $(EXEC)
# recipe for building the final executable
$(EXEC): $(OBJS) $(HDRS) Makefile
$(CC) -o $@ $(OBJS) $(CFLAGS)
# recipe for building object files
#$(OBJS): $(@:.o=.c) $(HDRS) Makefile
# $(CC) -o $@ $(@:.o=.c) -c $(CFLAGS)
# recipe to clean the workspace
clean:
rm -f $(EXEC) $(OBJS)
.PHONY: all clean