nsnake/Makefile

30 lines
626 B
Makefile
Raw Normal View History

2021-09-18 01:35:57 +00:00
CC = gcc
CFLAGS = -Wall -Wextra -pedantic-errors -std=c99 -Wno-format -lncurses
OUTFILE = nsnake
SRCDIR = src
OBJDIR = obj
INCDIR = src/include
SRC = $(wildcard $(SRCDIR)/*.c)
INC = $(wildcard $(INCDIR)/*.h)
_OBJ = $(SRC:.c=.o)
OBJ = $(subst $(SRCDIR),$(OBJDIR),$(_OBJ))
2021-09-18 03:35:02 +00:00
$(OUTFILE): $(OBJ) config.h
2021-09-18 01:35:57 +00:00
$(CC) $(CFLAGS) -o $(OUTFILE) $(OBJ)
2021-09-18 03:35:02 +00:00
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(INCDIR)/%.h config.h
2021-09-18 01:35:57 +00:00
@mkdir -p $(@D)
$(CC) $(CFLAGS) -o $@ -c $<
.PHONY: clean
clean:
-rm $(OUTFILE) $(OBJ)
2021-09-19 02:34:54 +00:00
.PHONY: install
install: $(OUTFILE)
cp $(OUTFILE) /usr/local/bin
chown root /usr/local/bin/$(OUTFILE)
chmod 755 /usr/local/bin/$(OUTFILE)