gnumake.mak 2.62 KB
Newer Older
thomas's avatar
   
thomas committed
1
2
3
4
5
6
7
# required settings:
#
# PLATFORM - win/mac/lnx
# RTSYS - pd/max
# COMPILER - msvc/gcc/mingw/cygwin
# BUILDPATH including trailing /

thomas's avatar
thomas committed
8
###############################################
thomas's avatar
   
thomas committed
9
# package info
thomas's avatar
thomas committed
10

thomas's avatar
thomas committed
11
12
13
ifndef PKGINFO
PKGINFO=package.txt
endif
thomas's avatar
thomas committed
14

thomas's avatar
thomas committed
15
include $(PKGINFO)
thomas's avatar
   
thomas committed
16

thomas's avatar
thomas committed
17
18
19
20
###############################################
# check variables

ifndef BUILDCLASS
thomas's avatar
thomas committed
21
BUILDCLASS=ext
thomas's avatar
thomas committed
22
23
24
endif

ifndef BUILDMODE
thomas's avatar
thomas committed
25
BUILDMODE=release
thomas's avatar
thomas committed
26
27
28
endif

ifndef BUILDTYPE
thomas's avatar
thomas committed
29
BUILDTYPE=single
thomas's avatar
thomas committed
30
31
32
33
34
35
36
37
38
39
40
41
42
endif

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

ifndef TARGETMODE
	TARGETMODE=$(BUILDMODE)
endif

ifndef TARGETTYPE
	TARGETTYPE=$(BUILDTYPE)
endif

###############################################
thomas's avatar
   
thomas committed
43
44
45
46
47
48
49
50

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

thomas's avatar
thomas committed
51
###############################################
thomas's avatar
   
thomas committed
52
53
54
55
56
57

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) \
thomas's avatar
thomas committed
58
	BUILDPATH=$(UBUILDPATH) PKGINFO=$(PKGINFO) BUILDCLASS=$(BUILDCLASS)
thomas's avatar
   
thomas committed
59

thomas's avatar
thomas committed
60
###############################################
thomas's avatar
   
thomas committed
61

thomas's avatar
thomas committed
62
ifdef BUILDDIR
thomas's avatar
   
thomas committed
63
USRCONFIG=config.txt
thomas's avatar
thomas committed
64
65
USRDEFAULT=$(BUILDDIR)/config-$(PLATFORM).def

thomas's avatar
thomas committed
66
USRMAKE=$(BUILDDIR)/gnumake-$(PLATFORM)-$(COMPILER).inc
thomas's avatar
   
thomas committed
67

thomas's avatar
thomas committed
68
OPTIONS+=USRCONFIG=$(USRCONFIG) USRMAKE=$(USRMAKE)
thomas's avatar
   
thomas committed
69
70
endif

thomas's avatar
thomas committed
71
72
###############################################
# include file describing default target dependencies
thomas's avatar
   
thomas committed
73

thomas's avatar
thomas committed
74
include $(BUILDPATH)targets.inc
thomas's avatar
thomas committed
75

thomas's avatar
thomas committed
76
include $(BUILDPATH)targets-$(BUILDCLASS).inc
thomas's avatar
   
thomas committed
77

thomas's avatar
thomas committed
78
###############################################
thomas's avatar
   
thomas committed
79
80
81
82

.precious: $(SYSCONFIG) $(USRCONFIG)

$(SYSCONFIG): $(SYSDEFAULT)
thomas's avatar
   
thomas committed
83
	@cp $< $@
thomas's avatar
   
thomas committed
84
85
86
	@echo -------------------------------------------------------------------------
	@echo A default system configuration file has been created.
	@echo Please edit $(SYSCONFIG) 
thomas's avatar
thomas committed
87
	@echo to match your platform, then start again.
thomas's avatar
   
thomas committed
88
89
90
	@echo -------------------------------------------------------------------------
	@false

thomas's avatar
thomas committed
91
ifdef BUILDDIR	
thomas's avatar
   
thomas committed
92
$(USRCONFIG): $(USRDEFAULT)
thomas's avatar
   
thomas committed
93
	@cp $< $@
thomas's avatar
   
thomas committed
94
95
	@echo -------------------------------------------------------------------------
	@echo A default package configuration file has been created.
thomas's avatar
thomas committed
96
	@echo Please edit $(USRCONFIG), then start again.
thomas's avatar
   
thomas committed
97
98
99
	@echo -------------------------------------------------------------------------
	@false

thomas's avatar
thomas committed
100
$(USRDEFAULT) $(USRMAKE):
thomas's avatar
   
thomas committed
101
102
	@echo -------------------------------------------------------------------------
	@echo Your combination of platform, system and compiler is not supported yet.
thomas's avatar
thomas committed
103
104
105
106
	@echo Required files: 
	@echo $(USRDEFAULT)
	@echo and
	@echo $(USRMAKE)
thomas's avatar
   
thomas committed
107
108
109
	@echo -------------------------------------------------------------------------
	@false
endif