-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (39 loc) · 1.16 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
# CS 111 Lab 1 Makefile
CC = gcc
CFLAGS = -g -Wall -Wextra #-Werror
LAB = 1
DISTDIR = lab1-$(USER)
CHECK_DIST = ./check-dist
all: timetrash
TESTS = $(wildcard test*.sh)
TEST_BASES = $(subst .sh,,$(TESTS))
TIMETRASH_SOURCES = \
alloc.c \
execute-command.c \
main.c \
read-command.c \
print-command.c
TIMETRASH_OBJECTS = $(subst .c,.o,$(TIMETRASH_SOURCES))
DIST_SOURCES = \
$(TIMETRASH_SOURCES) alloc.h command.h command-internals.h Makefile \
$(TESTS) check-dist README
timetrash: $(TIMETRASH_OBJECTS)
$(CC) $(CFLAGS) -o $@ $(TIMETRASH_OBJECTS)
alloc.o: alloc.h
execute-command.o main.o print-command.o read-command.o: command.h
execute-command.o print-command.o read-command.o: command-internals.h
dist: $(DISTDIR).tar.gz
$(DISTDIR).tar.gz: $(DIST_SOURCES) check-dist
rm -fr $(DISTDIR)
tar -czf $@.tmp --mode=u+w --transform='s,^,$(DISTDIR)/,' \
$(DIST_SOURCES)
$(CHECK_DIST) $(DISTDIR)
mv $@.tmp $@
Skeleton: $(DIST_SOURCES)
$(MAKE) CHECK_DIST=: USER=$@ lab1-$@.tar.gz
check: $(TEST_BASES)
$(TEST_BASES): timetrash
./$@.sh
clean:
rm -fr *.o *~ *.bak *.tar.gz core *.core *.tmp timetrash $(DISTDIR)
.PHONY: all dist check $(TEST_BASES) clean Skeleton