File: Makefile.generic

package info (click to toggle)
aspectc%2B%2B 1%3A2.2%2Bgit20181008-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,704 kB
  • sloc: cpp: 110,629; ansic: 7,644; sh: 2,192; makefile: 1,317; pascal: 634; python: 402; xml: 349
file content (97 lines) | stat: -rw-r--r-- 2,031 bytes parent folder | download | duplicates (5)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
ifeq ($(MAKELEVEL),0)
$(error Sorry, this makefile is not intended to be \
used directly. Please use the makefile in the toplevel \
directory of the ApectC++ source tree instead)
endif

CXX ?= g++ -O6
DIFF=diff --strip-trailing-cr
ACFLAGS += $(ACOPTFLAGS) -k

ifeq ($(filter -r, $(ACFLAGS)),)
  ACFLAGS += -r repo.acp
endif

ifneq ($(MAKECMDGOALS),run)
  ACFLAGS += -v9
endif

PROG:=feature$(EXT)

SOURCES := $(wildcard *.cc)

ACTEST :=$(shell pwd|sed -e s+/.*/++)

JUNK    := Junk
OBJECTS := $(addprefix $(JUNK)/,$(patsubst %.cc,%.o,$(SOURCES)))
DEPS    := $(addprefix $(JUNK)/,$(patsubst %.cc,%.d,$(SOURCES)))
ACC     := $(patsubst %.cc,%.acc,$(SOURCES))
HEADERS := $(wildcard *.h)
ASPECTS := $(wildcard *.ah)
INCLUDE_LIST := $(patsubst %.ah,-include %.ah,$(ASPECTS))

ifeq ($(WEAVE_ERROR),)
all: $(PROG)
else
all: $(ACC)
endif

run: all
	./$(PROG)

check: all


SED := $(foreach pat, $(AC_PATTERN_REPLACEMENTS), | sed -e "$(pat)")

diff:  $(PROG)
	./$(PROG) $(AC_PATTERN_REPLACEMENTS) > $(basename $(PROG)).out
	@$(DIFF) $(basename $(PROG)).out $(basename $(PROG)).ref
	@rm $(basename $(PROG)).out


diff-only:
	@cat $(basename $(PROG)).out $(AC_PATTERN_REPLACEMENTS) > $(basename $(PROG)).fil
	@$(DIFF) $(basename $(PROG)).fil $(basename $(PROG)).ref
	@rm $(basename $(PROG)).out $(basename $(PROG)).fil


ref:   $(PROG)	
	@./$(PROG) > $(basename $(PROG)).ref


feature$(EXT): $(OBJECTS)
	@echo Linking
	@$(CXX) $(CXXFLAGS) -o $@ $(OBJECTS)


clean:
	@rm -rf *.o $(JUNK) *.acc feature$(EXT) *~ *.acp

%.acc : %.cc
	@echo Weaving $<
ifeq ($(WEAVE_ERROR),)
	$(AC) $(ACFLAGS) -p . -c $< -o $@ 
else
	-$(AC) $(ACFLAGS) -p . -c $< -o $@ 
endif

$(JUNK)/%.o : %.acc
	@echo Compiling $<
	@$(CXX) $(CXXFLAGS) -x c++ -c $< -o $@

$(JUNK)/%.d : %.cc
	@mkdir -p $(JUNK)
	@$(CXX) $(CXXFLAGS) -x c++ -MM $(INCLUDE_LIST) $< | \
        sed -e "s/$*\.o/$(JUNK)\/& $(JUNK)\/$*.d $*.acc/g" > $@


ifneq ($(MAKECMDGOALS),clean)
-include $(DEPS)
endif

.PHONY: clean all run diff diff-only ref

# don't remove any intermediate files
.SECONDARY: