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

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

ps3: refactor elf → self build logic and make make_fself mandatory
when building for the PS3 on a Unix system.

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