summaryrefslogtreecommitdiffstats
path: root/hw2/Makefile.simple
blob: cdf5445f4ac0a510940d847205c5d63ab3d23e26 (plain) (blame)
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
# Programs
CC=         c99
RM=         rm -f

# Internal flags
SP_CFLAGS=  -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE $(CFLAGS)
SP_LIBS=    $(LDFLAGS)

# Let user to override these variables
CFLAGS=     -Wall -pipe -O2
LDFLAGS=

# Build dependencies
all_tasks=         big_judge judge player
big_judge_objs=    xwrap.o logger.o big_judge.o
judge_objs=        xwrap.o logger.o judge.o
player_objs=       xwrap.o logger.o player.o

# Phony target
.PHONY: all clean auto
auto:
    if [ ! -f configure ]; then autoreconf -iv; fi; ./configure && make
all: $(all_tasks)
clean:
    $(RM) $(all_tasks) $(big_judge_objs) $(judge_objs) $(player_objs)

# Suffix rules
.SUFFIXES: .c.o
.c.o:
    $(CC) $(SP_CFLAGS) -c $< -o $@

big_judge: $(big_judge_objs)
    $(CC) $(SP_CFLAGS) $(big_judge_objs) -o $@ $(SP_LDFLAGS)
judge: $(judge_objs)
    $(CC) $(SP_CFLAGS) $(judge_objs) -o $@ $(SP_LDFLAGS)
player: $(player_objs)
    $(CC) $(SP_CFLAGS) $(player_objs) -o $@ $(SP_LDFLAGS)