-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
136 lines (106 loc) · 4.32 KB
/
Makefile
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
# Unix Makefile for fvcbm
# Dan Fandrich
#
# Tested using GNU make & SCO's make
PREFIX= /usr/local
BINDIR= $(PREFIX)/bin
MANDIR= $(PREFIX)/share/man
# All the flags in $(CC) are optional and only used to generate warnings
# Linux
LINUX_CC= gcc
LINUX_CFLAGS= -O2 -DUNIX -Wall -Wshadow -Wpedantic -Wcast-qual -Wcast-align -Wwrite-strings -Wno-attributes
# SunOS (other than i386)
SUN4_CC= gcc
# This line allows more strict warnings, but gives lots on some systems
#SUN4_CC= gcc -pipe -ansi -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion
SUN4_CFLAGS= -O -DUNIX -DSUNOS -DIS_BIG_ENDIAN -pipe -ansi -pedantic -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings
# SCO UNIX (tested with SYSV/386 Rel. 3.2 with Microsoft C)
SCO_CC= cc
SCO_CFLAGS= -O -DUNIX -DSCO -W2
SCO_PACKFLAG= -Zp1
# 64-bit Windows using mingw64
WIN_CC= x86_64-w64-mingw32-gcc
WIN_CFLAGS= -O2 -Wall -Wshadow -Wpedantic -Wcast-qual -Wcast-align -Wwrite-strings -Wno-attributes
# generic big-endian machine with gcc (untested)
BIG_CC= gcc
BIG_CFLAGS= -O -DUNIX -DIS_BIG_ENDIAN -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings
# generic little-endian machine with gcc (untested)
LITTLE_CC= gcc
LITTLE_CFLAGS= -O -DUNIX -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings
# CP/M with Z88DK
CPM_CC= zcc
CPM_CFLAGS= +cpm -create-app
#
# Items below this line need not be changed
#
all:
@echo ""
@echo "Please run make with one of the following arguments"
@echo "cpm -- for CP/M machines with Z88DK cross-compiler"
@echo "dos -- for MS-DOS with Turbo C"
@echo "linux -- for Linux with gcc"
@echo "sun4 -- for SUN 4 OS"
@echo "sco -- for SCO machines with Microsoft cc"
@echo "sgi -- for SGI machines"
@echo "win -- for 64-bit Windows with mingw"
@echo "big -- for other big-endian machines with gcc (untested)"
@echo "little -- for other little-endian (or unknown) machines with gcc (untested)"
@echo "unknown -- for other unknown-endian machines with gcc (untested)"
@echo "test -- run regression tests"
@echo ""
cpm:
$(MAKE) targets CC="$(CPM_CC)" CFLAGS="$(CPM_CFLAGS) $(CFLAGS)" PACKFLAG=""
dos:
make -f makefile.dos
linux:
$(MAKE) targets CC="$(LINUX_CC)" CFLAGS="$(LINUX_CFLAGS) $(CFLAGS)" PACKFLAG=""
sun4:
$(MAKE) targets CC="$(SUN4_CC)" CFLAGS="$(SUN4_CFLAGS) $(CFLAGS)" PACKFLAG=""
sco:
$(MAKE) targets CC="$(SCO_CC)" CFLAGS="$(SCO_CFLAGS) $(CFLAGS)" PACKFLAG="$(SCO_PACKFLAG)"
sgi:
@echo "Sorry, it doesn't seem to be possible to pack structures with SGI's"
@echo "compiler. If you have gcc installed, try \"make big\"."
win:
$(MAKE) targets CC="$(WIN_CC)" CFLAGS="$(WIN_CFLAGS) $(CFLAGS)" PACKFLAG=""
big:
$(MAKE) targets CC="$(BIG_CC)" CFLAGS="$(BIG_CFLAGS) $(CFLAGS)" PACKFLAG=""
little unknown:
$(MAKE) targets CC="$(LITTLE_CC)" CFLAGS="$(LITTLE_CFLAGS) $(CFLAGS)" PACKFLAG=""
# It is expected that one of the above targets was used to build first
# This can be used to run a program with something like wine or qemu
TESTWRAPPER=
test:
$(TESTWRAPPER) ./fvcbm --
$(TESTWRAPPER) ./fvcbm -d --
$(TESTWRAPPER) ./fvcbm || test "$$?" = 1
$(TESTWRAPPER) ./fvcbm > generate.txt || test "$$?" = 1
$(TESTWRAPPER) ./fvcbm -h > generate.txt || test "$$?" = 1
$(TESTWRAPPER) ./fvcbm -d > generate.txt || test "$$?" = 1
$(TESTWRAPPER) ./fvcbm testdata/* > generate.txt 2>&1
diff expect.txt generate.txt
$(TESTWRAPPER) ./fvcbm -d testdata/* > generate.txt 2>&1
diff expect-d.txt generate.txt
$(TESTWRAPPER) ./fvcbm testdata/test1 > generate.txt 2>&1
diff expect-x.txt generate.txt
$(TESTWRAPPER) ./fvcbm -- testdata/test1 > generate.txt 2>&1
diff expect-x.txt generate.txt
#
# fvcbm targets below this line
#
targets: fvcbm fvcbm.man
fvcbm: fvcbm.o cbmarcs.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ fvcbm.o cbmarcs.o
cbmarcs.o: cbmarcs.c cbmarcs.h
$(CC) $(CFLAGS) $(PACKFLAG) -c $<
fvcbm.o: fvcbm.c cbmarcs.h
$(CC) $(CFLAGS) -c $<
fvcbm.man: fvcbm.1
nroff -man -c $? > $@
install:
install -m 755 -o root -g bin fvcbm $(BINDIR)
install -m 644 -o root -g root fvcbm.1 $(MANDIR)/man1
clean:
rm -f fvcbm fvcbm.exe fvcbm.com fvcbm.o cbmarcs.o fvcbm.man core generate.txt
zip:
zip -9z fvcbm.zip README desc.sdi file_id.diz descript.ion fvcbm.1 Makefile makefile.dos fvcbm.c cbmarcs.c cbmarcs.h fvcbm.exe COPYING < desc.sdi