File: Makefile

package info (click to toggle)
derivations 0.53.20120414-1.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,208 kB
  • ctags: 486
  • sloc: cpp: 1,634; perl: 600; makefile: 153; sh: 116
file content (52 lines) | stat: -rw-r--r-- 1,659 bytes parent folder | download | duplicates (3)
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

prog   := complete-pdf romanize
srcdir := Util Page_no TOC PDF
warn   := -Wall -Wextra

allobj := $(foreach dir, $(srcdir), \
  $(patsubst %.cc, %.o, \
    $(filter \
      $(patsubst %.h, %.cc, $(wildcard $(dir)/*.h)), \
      $(wildcard $(dir)/*.cc) \
    ) \
  ) \
)

include Makefile-optim
warn  += $(werror)
clean := cleanless clean
.PHONY: FORCE all alld allobj $(clean)
all : $(prog)
# The `alld:' target seems even to the Make program itself to make
# nothing, but notice the ifneq below the target.  The include directive
# therein makes the several %.d implicitly.  (The `alld:' maneuver is to
# let "make clean [program]" work as expected.  Observe however that the
# makefile includes the several %.d before it processes any targets,
# even the `clean:' target.  If this is of concern for some
# reason---maybe because one has been monkeying with timestamps---then
# one must give "make clean" and "make [program]" as separate commands.)
alld:
ifneq ($(strip $(filter-out $(clean), $(MAKECMDGOALS))),)
  alld := $(patsubst %.cc, %.d, $(wildcard *.cc))
  include $(alld)
endif
allobj: $(allobj)
$(foreach dir, $(srcdir), $(dir)/%): FORCE; $(MAKE) -C $(@D) $(@F)
%.d: %.cc; g++ -MM $< | sed -e 's/:/ $*.d:/' >$@
%.o: %.cc; g++ $(warn) $(optim) $(CXXFLAGS) -c $< -o $*.o

complete-pdf: complete-pdf.o $(allobj)
	g++ $(warn) $(optim) $^ -lpoppler -o $@

romanize: romanize.o Util/roman_numeral.o
	g++ $(warn) $(optim) $^ -o $@

a.out: test.o $(allobj)
	g++ $(warn) $(optim) $^ -lpoppler -o $@

cleanless:
	$(foreach dir, $(srcdir), $(MAKE) -C $(dir) clean ;)
	rm -fv *.d *.o *.gch a.out
	$(if $(alld), $(MAKE) alld)
clean: cleanless; rm -fv $(prog)