-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
148 lines (123 loc) · 3.81 KB
/
makefile
File metadata and controls
148 lines (123 loc) · 3.81 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# fbcunit library
#
# goals:
# library [default] - make just the library
# tests - make tests for the library itself
# examples - make the examples
# everything - make all of the above
# clean - remove output and temporary files
# help - show help and options
#
# variables:
# FBC location/name of the fbc compiler
# ARCH '-arch ARCH' option to pass to fbc compiler
# TARGET '-target TARGET' option to pass to fbc compiler
# and sets the object file and library file
# output directories
# LIBDIR output library directory and default location for
# the libary if TARGET was not explicitly set
# MKDIR name of the make directory command
# RM name of the remove command
# ECHO name of the echo to terminal command
#
FBC := fbc
MKDIR := mkdir -p
RM := rm -f
ECHO := echo
LIBDIR := lib
ifneq ($(ARCH),)
FBCFLAGS += -arch $(ARCH)
endif
ifneq ($(TARGET),)
FBCFLAGS += -target $(TARGET)
LIBTARGETDIR := $(LIBDIR)/$(TARGET)
else
LIBTARGETDIR := $(LIBDIR)
endif
ifneq ($(FPU),)
FBCFLAGS += -fpu $(FPU)
endif
LIBNAME := libfbcunit.a
SRCS := src/fbcunit.bas
SRCS += src/fbcunit_qb.bas
SRCS += src/fbcunit_console.bas
SRCS += src/fbcunit_report.bas
HDRS := inc/fbcunit.bi
HDRS += src/fbcunit_types.bi
HDRS += src/fbcunit_console.bi
HDRS += src/fbcunit_report.bi
TEST_SRCS := tests/tests.bas
TEST_SRCS += tests/fbcu_sanity.bas
TEST_SRCS += tests/fbcu_multiple.bas
TEST_SRCS += tests/fbcu_global.bas
TEST_SRCS += tests/fbcu_many_tests.bas
TEST_SRCS += tests/fbcu_append.bas
TEST_SRCS += tests/fbcu_append2.bas
TEST_SRCS += tests/fbcu_float.bas
TEST_SRCS += tests/fbcu_namespace.bas
TEST_SRCS += tests/fbcu_default.bas
TEST_SRCS += tests/fbcu_order.bas
TEST_SRCS += tests/fbcu_cases.bas
TEST_SRCS += tests/fbcu_console.bas
TEST_OBJS := $(patsubst %.bas,%.o,$(TEST_SRCS))
TEST_EXE := tests/tests.exe
EXAMPLES := examples/ex01.exe
EXAMPLES += examples/ex02.exe
EXAMPLES += examples/ex03.exe
EXAMPLES += examples/ex04.exe
EXAMPLES += examples/ex05.exe
EXAMPLES += examples/ex06.exe
EXAMPLES += examples/ex07.exe
EXAMPLES += examples/ex08.exe
EXAMPLES += examples/ex09.exe
EXAMPLES += examples/ex10.exe
EXAMPLES += examples/ex11.exe
FBCFLAGS += -mt -g -exx -i ./inc
.SUFFIXES: .bas
VPATH = .
.PHONY: all
all: library
$(sort $(LIBTARGETDIR) $(LIBDIR)) :
$(MKDIR) $@
.PHONY: help
help:
@$(ECHO) "usage: make target [options]"
@$(ECHO) ""
@$(ECHO) "Targets:"
@$(ECHO) " help - displays this information"
@$(ECHO) " library - builds $(LIBRARY)"
@$(ECHO) " tests - builds tests for fbcunit"
@$(ECHO) " examples - builds all the examples"
@$(ECHO) " everything - builds library, tests, examples"
@$(ECHO) " clean - cleans up all built files"
@$(ECHO) ""
@$(ECHO) "Options:"
@$(ECHO) " FBC=/path/fbc - set path to FBC compiler"
@$(ECHO) " TARGET=target"
@$(ECHO) " ARCH=arch (default is 486)"
@$(ECHO) " FPU=fpu | sse"
@$(ECHO) "Defaults:"
@$(ECHO) " FBC=fbc"
@$(ECHO) " LIBDIR=lib
@$(ECHO) " LIBTARGETDIR=<libdir>/<target>"
.PHONY: everything
everything: library tests examples
.PHONY: library
library: $(LIBTARGETDIR)/$(LIBNAME)
.PHONY: tests
tests: $(TEST_EXE)
.PHONY: examples
examples: $(EXAMPLES)
$(LIBTARGETDIR)/$(LIBNAME): $(SRCS) $(HDRS) | $(LIBTARGETDIR)
$(FBC) $(FBCFLAGS) -lib $(SRCS) -x $@
tests/%.o: tests/%.bas $(HDRS)
$(FBC) $(FBCFLAGS) -m tests -c $< -o $@
examples/%.exe: examples/%.bas $(HDRS) $(LIBTARGETDIR)/$(LIBNAME)
$(FBC) $(FBCFLAGS) $< -p $(LIBTARGETDIR) -x $@
$(TEST_EXE): $(TEST_OBJS) $(LIBTARGETDIR)/$(LIBNAME)
$(FBC) $(FBCFLAGS) $(TEST_OBJS) -p $(LIBTARGETDIR) -x $@
.PHONY: clean
clean:
-$(RM) $(LIBTARGETDIR)/$(LIBNAME)
-$(RM) $(TEST_OBJS) $(TEST_EXE)
-$(RM) $(EXAMPLES)