-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
47 lines (38 loc) · 893 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# for "make":
CC=gcc
OUTDIR=dist
TARGET=
SOURCES=particle-life.c
LIBS=
# for "make install":
DESTDIR=
PREFIX=
# platform specific settings
ifeq ($(OS),Windows_NT)
# Windows specific settings
TARGET=particle-life.exe
LIBS += pdcurses/*.o getopt/*.o
RM=powershell Remove-Item -Recurse -Force
MKDIR=powershell New-Item -ItemType Directory -Force
else
# Linux specific settings
TARGET=particle-life
LIBS += -l ncurses -l m
RM=rm -rf
MKDIR=mkdir -p
PREFIX=/usr/local
endif
all: $(OUTDIR)/$(TARGET)
$(OUTDIR):
$(MKDIR) $(OUTDIR)
$(OUTDIR)/$(TARGET): $(OUTDIR) $(SOURCES)
$(CC) -o $(OUTDIR)/$(TARGET) $(SOURCES) $(LIBS)
install: $(OUTDIR)/$(TARGET)
# create install directory
$(MKDIR) $(DESTDIR)$(PREFIX)/bin
# copy binary
cp $(OUTDIR)/$(TARGET) $(DESTDIR)$(PREFIX)/bin
# Phony target to clean the build artifacts
clean:
$(RM) $(OUTDIR)
.PHONY: all clean