Still not quite happy with the Makefiles.
[neverball] / Makefile.mingw
1 export EXT= .exe
2
3 #-----------------------------------------------------------------------------
4
5 include Makefile
6
7 #-----------------------------------------------------------------------------
8
9 WINE= wine
10
11 OGL_LIBS= -lm -lopengl32
12 BASE_LIBS= -lSDL -lSDL_image -lintl
13
14 LIBS= \
15         $(SDL_LIBS) -lSDL_image -lSDL_mixer -lSDL_ttf \
16         $(OGL_LIBS) $(PNG_LIBS) -lintl
17
18 #-----------------------------------------------------------------------------
19
20 INSTALLER= ../neverball-$(VERSION)-setup.exe
21
22 MAKENSIS= makensis
23 MAKENSIS_FLAGS= -DVERSION=$(VERSION) -DOUTFILE=$(INSTALLER)
24
25 TODOS= todos
26 FROMDOS= fromdos
27 CP= cp
28
29 TEXT_DOCS= \
30         doc/AUTHORS \
31         doc/MANUAL  \
32         CHANGES     \
33         COPYING     \
34         README
35
36 TXT_DOCS= $(TEXT_DOCS:%=%.txt)
37
38 #-----------------------------------------------------------------------------
39
40 .PHONY: setup
41 setup: $(INSTALLER)
42
43 $(INSTALLER): install-dlls convert-text-files all tools
44         $(MAKENSIS) $(MAKENSIS_FLAGS) -nocd scripts/neverball.nsi
45
46 $(INSTALLER): LDFLAGS := -s $(LDFLAGS)
47
48 .PHONY: clean-setup
49 clean-setup: clean
50         $(RM) install-dlls.sh *.dll $(TXT_DOCS)
51         find data -name "*.txt" -exec $(FROMDOS) {} \;
52         cd tools && $(MAKE) clean
53
54 #-----------------------------------------------------------------------------
55
56 .PHONY: install-dlls
57 install-dlls: install-dlls.sh
58         sh $<
59
60 install-dlls.sh:
61         if ! sh scripts/gen-install-dlls.sh > $@; then \
62             $(RM) $@; \
63             exit 1; \
64         fi
65         @echo --------------------------------------------------------
66         @echo You can probably ignore any file-not-found errors above.
67         @echo Now edit $@ to your needs before restarting make.
68         @echo --------------------------------------------------------
69         @exit 1
70
71 #-----------------------------------------------------------------------------
72
73 .PHONY: convert-text-files
74 convert-text-files: $(TXT_DOCS)
75         find data -name "*.txt" -exec $(TODOS) {} \;
76
77 %.txt: %
78         $(CP) $< $@
79         $(TODOS) $@
80
81 #-----------------------------------------------------------------------------
82
83 .PHONY: tools
84 tools:
85         cd tools && $(MAKE)
86
87 #-----------------------------------------------------------------------------