29 lines
626 B
Makefile
29 lines
626 B
Makefile
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))
|
|
|
|
$(OUTFILE): $(OBJ) config.h
|
|
$(CC) $(CFLAGS) -o $(OUTFILE) $(OBJ)
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(INCDIR)/%.h config.h
|
|
@mkdir -p $(@D)
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
-rm $(OUTFILE) $(OBJ)
|
|
|
|
.PHONY: install
|
|
install: $(OUTFILE)
|
|
cp $(OUTFILE) /usr/local/bin
|
|
chown root /usr/local/bin/$(OUTFILE)
|
|
chmod 755 /usr/local/bin/$(OUTFILE)
|