-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (30 loc) · 703 Bytes
/
Makefile
File metadata and controls
39 lines (30 loc) · 703 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
.PHONY: clean all
debug=1
GCC_FLAGS = -Wall -std=c89 -DDEBUG -g3
CLANG_FLAGS = -Wall -Wextra -std=c89 -DDEBUG -g -O0
ifeq ($(debug), 0)
GCC_FLAGS = -Wall -std=c89 -DNDEBUG
CLANG_FLAGS = -Wall -Wextra -std=c89 -DNDEBUG
endif
GCC = gcc
CLANG = clang
COMPILER = $(GCC)
CFLAGS = $(GCC_FLAGS)
ifeq ($(compiler), clang)
COMPILER = $(CLANG)
CFLAGS = $(CLANG_FLAGS)
endif
CC = $(COMPILER)
ex ?= 1.1
LIBDIR = lib/
LIBNAME = kr
LIBC = $(LIBDIR)reverse.c $(LIBDIR)getline.c
LIB = $(LIBDIR)libkr.a
LIBH = $(LIB:a=h)
all: $(LIB)
$(CC) $(CFLAGS) -o $(ex).o $(ex).c -L$(LIBDIR) -l$(LIBNAME) -I$(LIBDIR) -lm
$(LIB): $(LIBC) $(LIBH)
cd $(LIBDIR); make;
clean:
rm -f *.o a.out
cd $(LIBDIR); make clean;