-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathMakefile
More file actions
134 lines (113 loc) · 3.46 KB
/
Copy pathMakefile
File metadata and controls
134 lines (113 loc) · 3.46 KB
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
#!/usr/bin/make -f
#
# examples makefile - attempts to build all examples
#
# Several examples will not build if their libraries are not
# present.
#
# To make all examples:
# $ make
# To make a subset, use the dirname in lower case
# $ make unicode
#
# If fbc[.exe] is not in your path, pass it to make
# $ make FBC=d:/path/to/fbc
#
OS := $(shell uname)
ifeq ($(OS),Linux)
EXEEXT :=
DLLEXT := .so
else
EXEEXT := .exe
DLLEXT := .dll
endif
FBC := fbc$(EXEEXT)
STOP_ON_ERROR := n
BASICS := $(subst .bas,,$(wildcard *.bas))
COMPRESSION := $(subst .bas,,$(wildcard compression/*.bas))
CONSOLE := $(subst .bas,,$(wildcard console/*.bas)) \
$(subst .bas,,$(wildcard console/curses/*.bas)) \
$(subst .bas,,$(wildcard console/caca/*.bas))
DATABASE := $(subst .bas,,$(wildcard database/*.bas))
DLL := dll/dylib dll/libmydll$(DLLEXT) dll/test
DOS := $(subst .bas,,$(wildcard DOS/*.bas))
FILES := $(subst .bas,,$(wildcard files/*.bas files/*/*.bas))
GRAPHICS := $(subst .bas,,$(wildcard graphics/*.bas graphics/*/*.bas))
GUI := $(subst .bas,,$(wildcard GUI/*/*.bas GUI/*/*/*.bas))
MANUAL := $(subst .bas,,$(wildcard manual/*.bas manual/*/*.bas))
MATH := $(subst .bas,,$(wildcard math/*.bas math/*/*.bas))
MISC := $(subst .bas,,$(wildcard misc/*/*.bas))
NETWORK := $(subst .bas,,$(wildcard network/*.bas network/*/*.bas)) \
network/curl/CHttp/libCHttp.a network/curl/CHttp/test
#OPTIMIZE := $(subst .bas,,$(wildcard OptimizePureAbstractTypes/*.bas))
#REGEX := $(subst .bas,,$(wildcard regex/*/*.bas))
SOUND := $(subst .bas,,$(wildcard sound/*/*.bas))
THREADS := $(subst .bas,,$(wildcard threads/*.bas)) \
threads/timer-lib/libtimer$(DLLEXT) threads/timer-lib/test
UNICODE := $(subst .bas,,$(wildcard unicode/*.bas))
#WIN32 := $(subst .bas,,$(wildcard sound/*/*.bas))
XML := $(subst .bas,,$(wildcard xml/*.bas))
ALL_FILES := \
$(BASICS) $(COMPRESSION) $(CONSOLE) $(DATABASE) \
$(DLL) $(DOS) $(FILES) $(GRAPHICS) $(GUI) $(MANUAL) \
$(MATH) $(MISC) $(NETWORK) $(OPTIMIZE) $(SOUND) \
$(THREADS) $(UNICODE) $(XML)
all: $(ALL_FILES)
basics: $(BASICS)
compression: $(COMPRESSION)
console: $(CONSOLE)
database: $(DATABASE)
dll: $(DLL)
dos: $(DOS)
files: $(FILES)
graphics: $(GRAPHICS)
gui: $(GUI)
manual: $(MANUAL)
math: $(MATH)
misc: $(MISC)
#network: checklib.curl checklib.CHttp .WAIT $(NETWORK)
network: $(NETWORK)
optimize: $(OPTIMIZE)
sound: $(SOUND)
threads: $(THREADS)
unicode: $(UNICODE)
xml: $(XML)
checklib.%:
@echo check library: "lib$*"
@ldconfig -p | grep "lib$*.so" > /dev/null
dll/libmydll$(DLLEXT): dll/mydll.bas
$(FBC) -dylib $<
dll/test: dll/test.bas dll/libmydll$(DLLEXT)
$(FBC) -p dll dll/test.bas
ifeq ($(OS),Linux)
DOS/%: DOS/%.bas
@echo "SKIP $@ on Linux"
else
ifeq ($(OS),Windows_NT)
DOS/%: DOS/%.bas
@echo "SKIP $@ on Windows"
else
DOS/%: DOS/%.bas
$(FBC) $<
endif
endif
network/curl/CHttp/libCHttp.a: network/curl/CHttp/CHttp.bas \
network/curl/CHttp/CHttpForm.bas network/curl/CHttp/CHttpStream.bas
$(FBC) -lib $^
network/curl/CHttp/test: network/curl/CHttp/libCHttp.a
$(FBC) -p $(dir $@) $@.bas $<
threads/timer-lib/libtimer$(DLLEXT): threads/timer-lib/timer.bas
$(FBC) -dylib -mt $<
threads/timer-lib/test: threads/timer-lib/test.bas threads/timer-lib/libtimer$(DLLEXT)
$(FBC) -p $(dir $@) -mt $<
%: %.bas
ifeq ($(STOP_ON_ERROR),n)
@echo fbc -p $(dir $@) $<
@$(FBC) -p $(dir $@) $< || \
echo "Failed to compile '$<' - check for missing libraries"
else
$(FBC) -p $(dir $@) $<
endif
clean:
@echo CLEAN binary files
@rm -fv $(ALL_FILES)