aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/buildsys/gnumake.mak
blob: 85559e1309bb99ca4cf984c809c554ce1944a87e (plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# required settings:
#
# PLATFORM - win/mac/lnx
# RTSYS - pd/max
# COMPILER - msvc/gcc/mingw/cygwin
# BUILDPATH including trailing /

###############################################
# package info

ifndef PKGINFO
PKGINFO=package.txt
endif

ifneq ($(PKGINFO),)
include $(PKGINFO)
endif

###############################################
# check variables

ifndef BUILDCLASS
BUILDCLASS=ext
endif

ifndef BUILDMODE
BUILDMODE=release
endif

ifndef BUILDTYPE
BUILDTYPE=single
endif

##############################

#ifndef TARGETMODE
#TARGETMODE=$(BUILDMODE)
#endif

#ifndef TARGETTYPE
#TARGETTYPE=$(BUILDTYPE)
#endif

###############################################

ifeq ($(PLATFORM),win)
	# substitute eventual \ by /
	UBUILDPATH=$(subst \,/,$(BUILDPATH))
else
	UBUILDPATH=$(BUILDPATH)
endif

###############################################

SYSCONFIG=$(UBUILDPATH)config-$(PLATFORM)-$(RTSYS)-$(COMPILER).txt
SYSDEFAULT=$(UBUILDPATH)$(PLATFORM)/$(RTSYS)/config-$(COMPILER).def

OPTIONS=-f $(UBUILDPATH)gnumake-sub.mak \
	PLATFORM=$(PLATFORM) RTSYS=$(RTSYS) COMPILER=$(COMPILER) \
	BUILDPATH=$(UBUILDPATH) PKGINFO=$(PKGINFO) BUILDCLASS=$(BUILDCLASS)

###############################################

ifdef BUILDDIR
USRCONFIG=config.txt
USRDEFAULT=$(BUILDDIR)/config-$(PLATFORM).def

USRMAKE=$(BUILDDIR)/gnumake-$(PLATFORM)-$(COMPILER).inc

OPTIONS+=USRCONFIG=$(USRCONFIG) USRMAKE=$(USRMAKE)
endif

###############################################
# include file describing default target dependencies

.PHONY : all build clean install profile

include $(BUILDPATH)targets.inc

include $(BUILDPATH)targets-$(BUILDCLASS).inc

###############################################

.PRECIOUS: $(SYSCONFIG) $(USRCONFIG)

$(SYSCONFIG): $(SYSDEFAULT)
ifeq ($(COMPILER),mingw)
	@copy $(subst /,\,$<) $(subst /,\,$@)
else
	@cp $< $@
endif
	@echo -------------------------------------------------------------------------
	@echo A default system configuration file has been created.
	@echo Please edit $(SYSCONFIG) 
	@echo to match your platform, then start again.
	@echo -------------------------------------------------------------------------
ifeq ($(COMPILER),mingw)
	@exit 1
else
	@false
endif

ifdef BUILDDIR
$(USRCONFIG): $(USRDEFAULT)
ifeq ($(COMPILER),mingw)
	@copy $(subst /,\,$<) $(subst /,\,$@)
else
	@cp $< $@
endif
	@echo -------------------------------------------------------------------------
	@echo A default package configuration file has been created.
	@echo Please edit $(USRCONFIG), then start again.
	@echo -------------------------------------------------------------------------
ifeq ($(COMPILER),mingw)
	@exit 1
else
	@false
endif

$(USRDEFAULT) $(USRMAKE):
	@echo -------------------------------------------------------------------------
	@echo Your combination of platform, system and compiler is not supported yet.
	@echo Required files: 
	@echo $(USRDEFAULT)
	@echo and
	@echo $(USRMAKE)
	@echo -------------------------------------------------------------------------
ifeq ($(COMPILER),mingw)
	@exit 1
else
	@false
endif

endif