-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
40 lines (24 loc) · 759 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
BUILDDIR=build
SRCS=$(wildcard *.c)
PROG_SRCS=$(wildcard exercises/exercise*.c)
PROGRAMS=$(patsubst exercises/%.c,$(BUILDDIR)/exercises/%, $(PROG_SRCS) )
SHARED_SRCS=$(wildcard shared/*.c)
SHARED_OBJS=$(patsubst shared/%.c,$(BUILDDIR)/shared/%.o, $(SHARED_SRCS) )
CFLAGS+= -Wall -Wextra -Werror -pedantic-errors -std=c89
CFLAGS+= -I./shared
all: ${PROGRAMS}
foo:
echo $(PROG_SRCS)
echo $(PROGRAMS)
echo $(SHARED_OBJS)
$(BUILDDIR)/%: %.c $(SHARED_OBJS) $(BUILDDIR)
$(CC) -g $(CFLAGS) $(INCLUDES) $(SHARED_OBJS) $< -o $@
$(BUILDDIR)/%.o: %.c
$(CC) -g $(CFLAGS) -c $< -o $@
$(BUILDDIR):
mkdir -p $(BUILDDIR) $(BUILDDIR)/utils $(BUILDDIR)/exercises $(BUILDDIR)/shared
clean:
rm -rf $(BUILDDIR)
test:
./test-entab.sh
.PHONY: all clean test