-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 802 Bytes
/
Copy pathMakefile
File metadata and controls
37 lines (27 loc) · 802 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
CC = gcc
CFLAGS = -std=gnu99 -pedantic -Wall -Werror -lm
#OPTFLAG = -O2
DEBUGFLAG = -g
# This is the name of the static archive to produce
# Don't change this line
LIBRARY = malloc
# The C and H files
# Your test file SHOULD NOT be in this line
CFILES = my_malloc.c my_sbrk.c
HFILES = my_malloc.h
PROGRAM = hw11
# Targets:
# test -- runs your test program
# clean -- removes compiled code from the directory
#test: CFLAGS += $(OPTFLAG)
test: $(PROGRAM)-test
./$(PROGRAM)-test
$(PROGRAM)-test: lib$(LIBRARY).a test.c
$(CC) $(CFLAGS) $(DEBUGFLAG) test.c -L . -l$(LIBRARY) -o $@
OFILES = $(patsubst %.c,%.o,$(CFILES))
lib$(LIBRARY).a: $(OFILES)
ar -cr lib$(LIBRARY).a $(OFILES)
%.o: %.c $(HFILES)
$(CC) $(CFLAGS) $(DEBUGFLAG) -c $<
clean:
rm -rf lib$(LIBRARY).a $(PROGRAM)-test $(OFILES)