-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrules.mk
46 lines (31 loc) · 1.27 KB
/
rules.mk
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
# Internal build rules for building send-echo-request.
# Requires outdir, CC, NM, OBJDUMP, STRIP to be set appropriately.
# CFLAGS & Co. are exported by the calling makefile implicitly.
outdir = .
TARGETS =
TARGETS += $(outdir)/$(BASE).exe $(outdir)/$(BASE).stripped
TARGETS += $(outdir)/$(BASE).lss $(outdir)/$(BASE).sym
.PHONY: all
all: $(TARGETS)
$(outdir)/$(BASE).exe: $(outdir)/send-echo-request.o
$(CC) -o $@ $(LDFLAGS) $(LIBS) $^
%.lss: %.exe
$(OBJDUMP) -h -S $< > $@
%.sym: %.exe
$(NM) -n $< > $@
%.stripped: %.exe
$(STRIP) -o $@ $<
CLEANFILES += $(outdir)/send-echo-request.o
$(outdir)/send-echo-request.o : CFLAGS += -std=gnu99
$(outdir)/send-echo-request.o : CFLAGS += -Wall
$(outdir)/send-echo-request.o : CFLAGS += -Wextra
$(outdir)/send-echo-request.o : CFLAGS += -Werror
$(outdir)/send-echo-request.o : CFLAGS += -pedantic
$(outdir)/send-echo-request.o : CFLAGS += -g
# -O optimizes strlen() calls on string literals into constant numbers
$(outdir)/send-echo-request.o : CFLAGS += -Os
$(outdir)/send-echo-request.o : send-echo-request.c git-version.h usage-msg.h
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
# Force recompile when we change the compile flags in GNUmakefile or rules.mk
$(outdir)/send-echo-request.o : GNUmakefile
$(outdir)/send-echo-request.o : rules.mk