-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (53 loc) · 1.35 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# PZAB Interpreter Makefile
# -------------------------
# Makefile for the interpreter for the PZAB programming language.
# See README for information on setting up this makefile.
#
# Copyright (C) 2015 Zac Herd <[email protected]>
# Released under the GNU General Public License v2.
# See LICENSE for more info
#
###################
# BUILD VARIABLES #
###################
# Compiler to use
CC = gcc
# Compiler flags
CFLAGS = -g
# Directory containing source files
SOURCEDIR = src
# Directory to build objects
OBJDIR = obj
# Directory to build executable
BUILDDIR = bin
# Executable to produce
TARGET = pzab
# Directory to install to
INSTDIR = /usr/local/bin
# NOTHING SHOULD NEED TO CHANGE BEYOND THIS POINT
# Source files to use
SOURCES = $(wildcard $(SOURCEDIR)/*.c)
# Objects to compile in executable
OBJS = $(patsubst $(SOURCEDIR)/%.c,$(OBJDIR)/%.o,$(SOURCES))
#################
# BUILD TARGETS #
#################
# make target
.PHONY: all
all: $(SOURCES) $(BUILDDIR)/$(TARGET)
$(BUILDDIR)/$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $@
$(OBJS): $(OBJDIR)/%.o: $(SOURCEDIR)/%.c
$(CC) -c $(CFLAGS) $< -o $@
# install target
.PHONY: install
install:
cp $(BUILDDIR)/$(TARGET) $(INSTDIR)/$(TARGET)
# uninstall target
.PHONY: uninstall
uninstall:
rm $(INSTDIR)/$(TARGET)
# clean build directories
.PHONY: clean
clean:
rm -fr $(OBJDIR)/*o $(BUILDDIR)/$(TARGET)