forked from DmitriyKustov/texteditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (34 loc) · 822 Bytes
/
Makefile
File metadata and controls
44 lines (34 loc) · 822 Bytes
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
##
# Makefile for simple line editor
# Author: Alexander Borodin, <aborod@petrsu.ru>
#
# Compiler
CC = gcc
# Linker
LD = gcc
# Build debug version of the editor
debug: MFLAGS += debug
debug: CFLAGS += -Wall -Wextra -DDEBUG -g -O0
debug: editor
# Build release version of the editor
release: MFLAGS += release
release: CFLAGS += -DNDEBUG
release: editor
# List sources and target object files
SOURCES = $(wildcard *.c)
OBJECTS = $(patsubst %.c, %.o, $(SOURCES))
# Build editor
editor: $(OBJECTS) text
$(LD) $(LDFLAGS) -o editor $(OBJECTS) -L./text -ltext
# Build text processing library
.PHONY: text
text:
cd text && $(MAKE) $(MFLAGS)
# Compile editor
%.o: %.c text/text.h
$(CC) -c $(CFLAGS) -o $@ $<
# Clean phony target to remove binary files
.PHONY: clean
clean:
cd text && $(MAKE) $@
rm -rf *.o editor