|
| 1 | +#!/usr/bin/make -f |
| 2 | +# |
| 3 | +# examples makefile - attempts to build all examples |
| 4 | +# |
| 5 | +# Several examples will not build if their libraries are not |
| 6 | +# present. |
| 7 | +# |
| 8 | +# To make all examples: |
| 9 | +# $ make |
| 10 | +# To make a subset, use the dirname in lower case |
| 11 | +# $ make unicode |
| 12 | +# |
| 13 | +# If fbc[.exe] is not in your path, pass it to make |
| 14 | +# $ make FBC=d:/path/to/fbc |
| 15 | +# |
| 16 | + |
| 17 | +OS := $(shell uname) |
| 18 | +ifeq ($(OS),Linux) |
| 19 | + EXEEXT := |
| 20 | + DLLEXT := .so |
| 21 | +else |
| 22 | + EXEEXT := .exe |
| 23 | + DLLEXT := .dll |
| 24 | +endif |
| 25 | + |
| 26 | +FBC := fbc$(EXEEXT) |
| 27 | +STOP_ON_ERROR := n |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +BASICS := $(subst .bas,,$(wildcard *.bas)) |
| 32 | +COMPRESSION := $(subst .bas,,$(wildcard compression/*.bas)) |
| 33 | +CONSOLE := $(subst .bas,,$(wildcard console/*.bas)) \ |
| 34 | + $(subst .bas,,$(wildcard console/curses/*.bas)) \ |
| 35 | + $(subst .bas,,$(wildcard console/caca/*.bas)) |
| 36 | +DATABASE := $(subst .bas,,$(wildcard database/*.bas)) |
| 37 | +DLL := dll/dylib dll/libmydll$(DLLEXT) dll/test |
| 38 | +DOS := $(subst .bas,,$(wildcard DOS/*.bas)) |
| 39 | +FILES := $(subst .bas,,$(wildcard files/*.bas files/*/*.bas)) |
| 40 | +GRAPHICS := $(subst .bas,,$(wildcard graphics/*.bas graphics/*/*.bas)) |
| 41 | +GUI := $(subst .bas,,$(wildcard GUI/*/*.bas GUI/*/*/*.bas)) |
| 42 | +MANUAL := $(subst .bas,,$(wildcard manual/*.bas manual/*/*.bas)) |
| 43 | +MATH := $(subst .bas,,$(wildcard math/*.bas math/*/*.bas)) |
| 44 | +MISC := $(subst .bas,,$(wildcard misc/*/*.bas)) |
| 45 | +NETWORK := $(subst .bas,,$(wildcard network/*.bas network/*/*.bas \ |
| 46 | + network/*/*/*.bas)) |
| 47 | +#OPTIMIZE := $(subst .bas,,$(wildcard OptimizePureAbstractTypes/*.bas)) |
| 48 | +#REGEX := $(subst .bas,,$(wildcard regex/*/*.bas)) |
| 49 | +SOUND := $(subst .bas,,$(wildcard sound/*/*.bas)) |
| 50 | +THREADS := $(subst .bas,,$(wildcard threads/*.bas)) \ |
| 51 | + threads/timer-lib/libtimer$(DLLEXT) threads/timer-lib/test |
| 52 | +UNICODE := $(subst .bas,,$(wildcard unicode/*.bas)) |
| 53 | +#WIN32 := $(subst .bas,,$(wildcard sound/*/*.bas)) |
| 54 | +XML := $(subst .bas,,$(wildcard xml/*.bas)) |
| 55 | + |
| 56 | + |
| 57 | +ALL_FILES := \ |
| 58 | + $(BASICS) $(COMPRESSION) $(CONSOLE) $(DATABASE) \ |
| 59 | + $(DLL) $(DOS) $(FILES) $(GRAPHICS) $(GUI) $(MANUAL) \ |
| 60 | + $(MATH) $(MISC) $(NETWORK) $(OPTIMIZE) $(SOUND) \ |
| 61 | + $(THREADS) $(UNICODE) $(XML) |
| 62 | + |
| 63 | +all: $(ALL_FILES) |
| 64 | + |
| 65 | +basics: $(BASICS) |
| 66 | +compression: $(COMPRESSION) |
| 67 | +console: $(CONSOLE) |
| 68 | +database: $(DATABASE) |
| 69 | +dll: $(DLL) |
| 70 | +dos: $(DOS) |
| 71 | +files: $(FILES) |
| 72 | +graphics: $(GRAPHICS) |
| 73 | +gui: $(GUI) |
| 74 | +manual: $(MANUAL) |
| 75 | +math: $(MATH) |
| 76 | +misc: $(MISC) |
| 77 | +#network: checklib.curl checklib.CHttp .WAIT $(NETWORK) |
| 78 | +network: $(NETWORK) |
| 79 | +optimize: $(OPTIMIZE) |
| 80 | +sound: $(SOUND) |
| 81 | +threads: $(THREADS) |
| 82 | +unicode: $(UNICODE) |
| 83 | +xml: $(XML) |
| 84 | + |
| 85 | + |
| 86 | +checklib.%: |
| 87 | + @echo check library: "lib$*" |
| 88 | + @ldconfig -p | grep "lib$*.so" > /dev/null |
| 89 | + |
| 90 | + |
| 91 | +dll/libmydll$(DLLEXT): dll/mydll.bas |
| 92 | + $(FBC) -dylib $< |
| 93 | + |
| 94 | +dll/test: dll/test.bas dll/libmydll$(DLLEXT) |
| 95 | + $(FBC) -p dll dll/test.bas |
| 96 | + |
| 97 | +ifeq ($(OS),Linux) |
| 98 | +DOS/%: DOS/%.bas |
| 99 | + @echo "SKIP $@ on Linux" |
| 100 | +else |
| 101 | +ifeq ($(OS),Windows_NT) |
| 102 | +DOS/%: DOS/%.bas |
| 103 | + @echo "SKIP $@ on Windows" |
| 104 | +else |
| 105 | +DOS/%: DOS/%.bas |
| 106 | + $(FBC) $< |
| 107 | +endif |
| 108 | +endif |
| 109 | + |
| 110 | +threads/timer-lib/libtimer$(DLLEXT): threads/timer-lib/timer.bas |
| 111 | + $(FBC) -dylib -mt $< |
| 112 | + |
| 113 | +threads/timer-lib/test: threads/timer-lib/test.bas threads/timer-lib/libtimer$(DLLEXT) |
| 114 | + $(FBC) -p $(dir $@) -mt $< |
| 115 | + |
| 116 | +%: %.bas |
| 117 | +ifeq ($(STOP_ON_ERROR),n) |
| 118 | + @echo fbc -p $(dir $@) $< |
| 119 | + @$(FBC) -p $(dir $@) $< || \ |
| 120 | + echo "Failed to compile '$<' - check for missing libraries" |
| 121 | +else |
| 122 | + $(FBC) -p $(dir $@) $< |
| 123 | +endif |
| 124 | + |
| 125 | +clean: |
| 126 | + @echo CLEAN binary files |
| 127 | + @rm -fv $(ALL_FILES) |
0 commit comments