source: trunk/build/autotools/common.am @ 2575

Last change on this file since 2575 was 2575, checked in by sam, 8 years ago

build: reorganise automake build system.

File size: 2.8 KB
Line 
1
2#
3# Define these variables from the beginning
4#
5
6CLEANFILES =
7SUFFIXES =
8EXTRA_DIST =
9
10
11#
12# Miscellaneous rules
13#
14
15lol_recursive_rule = \
16        @if test -n "$(SUBDIRS)"; then for subdir in $(SUBDIRS); do \
17          ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $(patsubst %-recursive, %, $@)) || exit 1; \
18        done; fi
19
20bench: bench-recursive
21bench-recursive:
22        $(lol_recursive_rule)
23
24lolcheck: lolcheck-recursive
25lolcheck-recursive:
26        $(lol_recursive_rule)
27
28
29#
30# Flex and Bison files build rule
31#
32
33generated: generated-recursive
34generated-recursive:
35        $(lol_recursive_rule)
36        @if test -n "$(filter %-scanner.l, $(EXTRA_DIST))"; then \
37          echo $(MKDIR_P) generated; \
38          $(MKDIR_P) generated; \
39          rm -f generated/[a-zA-Z]*; \
40          for scanner in $(patsubst %-scanner.l, %, $(filter %-scanner.l, $(EXTRA_DIST))); do \
41            b="`basename $$scanner`"; \
42            echo flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l"; \
43            flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l" || exit 1; \
44          done; \
45          for parser in $(patsubst %-parser.y, %, $(filter %-parser.y, $(EXTRA_DIST))); do \
46            b="`basename $$parser`"; \
47            echo bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y"; \
48            bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y" || exit 1; \
49          done; \
50        fi
51
52
53#
54# .lolfx build rule
55#
56
57lolfx_gen = $(lolfx_gen_$(V))
58lolfx_gen_ = $(lolfx_gen_$(AM_DEFAULT_VERBOSITY))
59lolfx_gen_0 = @echo "  LOLFX " $@;
60
61SUFFIXES += .lolfx
62.lolfx.o:
63        $(lolfx_gen)
64        $(AM_V_at)(echo "char const *"; \
65         echo "lolfx_resource_$(notdir $(basename $(filter %.lolfx, $^))) ="; \
66         $(SED) 's/"/\\"/g' $(filter %.lolfx, $^) | $(SED) 's/\([^\r]*\).*/"\1\\n"/'; \
67         echo ";") \
68        | $(CXXCOMPILE) -xc++ -c - -o $@
69
70
71#
72# PS3 fself support rules
73#
74
75fself_gen = $(fself_gen_$(V))
76fself_gen_ = $(fself_gen_$(AM_DEFAULT_VERBOSITY))
77fself_gen_0 = echo "  FSELF " $${x}.self;
78fself_gen_1 = echo make_fself $${x}$(EXEEXT) $${x}.self;
79
80all-local: all-local-ps3
81all-local-ps3: $(PROGRAMS) $(noinst_PROGRAMS)
82        @if test -n "$^"; then for x in $(^:%$(EXEEXT)=%); do \
83          if test x$(MAKE_FSELF) != xno; then \
84            $(fself_gen) \
85            make_fself $${x}$(EXEEXT) $${x}.self; \
86          fi; \
87        done; fi
88
89CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.self) \
90              $(PROGRAMS:%$(EXEEXT)=%.elf) \
91              $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \
92              $(noinst_PROGRAMS:%$(EXEEXT)=%.elf)
93
94
95#
96# Win32 rules
97#
98
99# This is here in case we forget to make clean after a Windows build
100CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.exe) \
101              $(noinst_PROGRAMS:%$(EXEEXT)=%.exe)
102
103
104#
105# Additional rules
106#
107
108EXTRA_DIST += $(foreach p, $(noinst_PROGRAMS), $($(p)_DATA))
109EXTRA_DIST += $(foreach p, $(bin_PROGRAMS), $($(p)_DATA))
110
111
112.PHONY: bench lolcheck generated
113
Note: See TracBrowser for help on using the repository browser.