-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (26 loc) · 683 Bytes
/
Makefile
File metadata and controls
32 lines (26 loc) · 683 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
CFLAGS=-Wall -lm -lcrypt -O2 -pipe -ansi -DONLINE_JUDGE
#CFLAGS=-g -Wall -pg -static
SOURCES := $(wildcard *.c)
PROGS := $(patsubst %.c, %, $(SOURCES))
TESTS := $(patsubst %.c, %.test, $(SOURCES))
all: $(PROGS)
%:%.c
$(CC) $(CFLAGS) -c -o $@.o $<
$(CC) $(CFLAGS) -o $@ $@.o
#$(CC) $(CFLAGS) -o $@ $<
#%.o: %.c
# $(CC) $(CFLAGS) -c -o $@ $<
#
#%:%.o
# $(CC) $(CFLAGS) -o $@ $<
#TODO: this rule is not working - does not rebuild programs for out files
%.out: %
%.out: %.in %.ans
./$* < $*.in > $*.out
test: $(TESTS)
%.test: %.out %.ans
diff $^ > $@ || ( cat $@ && false )
.PHONY: all tests clean
.DELETE_ON_ERROR: $(TESTS)
clean:
-@rm $(PROGS) *.out *.test 2>/dev/null *.o