-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (38 loc) · 902 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
47
48
49
50
VERSION = 0.2
TARGET = minirc
PREFIX ?= /usr/local
CC = g++
CPPFLAGS = -std=c++11 -DVERSION=$(VERSION)
LFLAGS =
BDIR = build
ODIR = objs
SDIR = minirc
INC = -I"minirc"
MD = mkdir -p
_OBJS = main.o minirc.o
OBJS = $(patsubst %,$(ODIR)/%,$(_OBJS))
.PHONY: all clean install uninstall directories
all : directories $(TARGET) example_binary example_text
directories: $(BDIR) $(ODIR)
$(BDIR):
$(MD) $(BDIR)
$(ODIR):
$(MD) $(ODIR)
$(TARGET): $(OBJS)
$(CC) $(OBJS) $(LFLAGS) -o $(BDIR)/$(TARGET)
$(ODIR)/%.o: $(SDIR)/%.cpp
$(CC) -c $(INC) -o $@ $< $(CPPFLAGS)
example_binary:
$(MAKE) -C example/binary clean
$(MAKE) -C example/binary
example_text:
$(MAKE) -C example/text clean
$(MAKE) -C example/text
clean:
rm -f $(ODIR)/*.o $(BDIR)/*
$(MAKE) -C example/binary clean
$(MAKE) -C example/text clean
install:
install $(TARGET) $(PREFIX)/bin
uninstall:
rm -rf $(PREFIX)/bin/$(TARGET)