aboutsummaryrefslogtreecommitdiff
path: root/makefile.gnu
blob: 4994bdd7a674c8f50ef5c49b1ec39691927f1fbb (plain)
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#
# Automagically generated by Approximatrix Simply Fortran 3.14
#
FC?="gfortran"
CC?="gcc"
AR?="ar"
WRC?="windres"
RM=rm -f

IDIR=

LDIR=

DESTDIR?=/usr/local
 
ZIPFILE=lr87-src-$(shell date +%Y%m%d).zip

OPTFLAGS= -g

SPECIALFLAGS=$(IDIR)

RCFLAGS=-O coff

PRJ_FFLAGS=

PRJ_CFLAGS=

PRJ_LFLAGS=-lssl -lcrypto -lpthread -ldl

FFLAGS=$(SPECIALFLAGS) $(OPTFLAGS) $(PRJ_FFLAGS) -Jmodules 

CFLAGS=$(SPECIALFLAGS) $(OPTFLAGS) $(PRJ_CFLAGS)

build:
	mkdir -p $@

modules:
	mkdir -p $@

.PHONY: all clean

build/binary.o: binary.f90 | modules build
	@echo Compiling binary.f90
	@$(FC) -c -o "build/binary.o" $(FFLAGS) "binary.f90"
modules/binary.mod : | modules build/binary.o

build/dumb_binary.o: dumb_binary.f90 modules/binary.mod | modules build
	@echo Compiling dumb_binary.f90
	@$(FC) -c -o "build/dumb_binary.o" $(FFLAGS) "dumb_binary.f90"
modules/dumb_binary.mod : | modules build/dumb_binary.o

build/dumb_render.o: dumb_render.f90 modules/render.mod | modules build
	@echo Compiling dumb_render.f90
	@$(FC) -c -o "build/dumb_render.o" $(FFLAGS) "dumb_render.f90"
modules/dumb_render.mod : | modules build/dumb_render.o

build/escape.o: escape.f90 | modules build
	@echo Compiling escape.f90
	@$(FC) -c -o "build/escape.o" $(FFLAGS) "escape.f90"
modules/escaper.mod : | modules build/escape.o

build/favorites.o: favorites.f90 | modules build
	@echo Compiling favorites.f90
	@$(FC) -c -o "build/favorites.o" $(FFLAGS) "favorites.f90"
modules/favorite_handling.mod : | modules build/favorites.o

build/files.o: files.f90 modules/layout.mod | modules build
	@echo Compiling files.f90
	@$(FC) -c -o "build/files.o" $(FFLAGS) "files.f90"
modules/file_handling.mod : | modules build/files.o

build/history.o: history.f90 | modules build
	@echo Compiling history.f90
	@$(FC) -c -o "build/history.o" $(FFLAGS) "history.f90"
modules/history.mod : | modules build/history.o

build/internal.o: internal.F90 modules/favorite_handling.mod modules/file_handling.mod | modules build
	@echo Compiling internal.F90
	@$(FC) -c -o "build/internal.o" $(FFLAGS) "internal.F90"
modules/internal_links.mod : | modules build/internal.o

build/favicon.o: favicon.f90 modules/platform.mod modules/gemini_protocol.mod
	@echo Compiling favicon.f90
	@$(FC) -c -o "build/favicon.o" $(FFLAGS) "favicon.f90"
modules/favicon.mod: | build/favicon.o

build/jessl.o: jessl.f90 | modules build
	@echo Compiling jessl.f90
	@$(FC) -c -o "build/jessl.o" $(FFLAGS) "jessl.f90"
modules/jessl.mod : | modules build/jessl.o

build/layout.o: layout.f90 modules/render.mod | modules build
	@echo Compiling layout.f90
	@$(FC) -c -o "build/layout.o" $(FFLAGS) "layout.f90"
modules/layout.mod : | modules build/layout.o

build/main.o: main.F90 modules/favicon.mod modules/request.mod modules/dumb_render.mod modules/dumb_binary.mod modules/render.mod modules/gemini_protocol.mod modules/layout.mod modules/file_handling.mod modules/history.mod modules/internal_links.mod modules/favorite_handling.mod modules/platform.mod | modules build
	@echo Compiling main.F90
	@$(FC) -c -o "build/main.o" $(FFLAGS) "main.F90"

build/network.o: network.F90 | modules build
	@echo Compiling network.F90
	@$(FC) -c -o "build/network.o" $(FFLAGS) "network.F90"
modules/network.mod : | modules build/network.o

build/platform.o: platform.F90 | modules build
	@echo Compiling platform.F90
	@$(FC) -c -o "build/platform.o" $(FFLAGS) "platform.F90"
modules/platform.mod : | modules build/platform.o

build/protocol.o: protocol.f90 modules/request.mod modules/file_handling.mod modules/binary.mod | modules build
	@echo Compiling protocol.f90
	@$(FC) -c -o "build/protocol.o" $(FFLAGS) "protocol.f90"
modules/gemini_protocol.mod : | modules build/protocol.o

build/render.o: render.f90 modules/escaper.mod | modules build
	@echo Compiling render.f90
	@$(FC) -c -o "build/render.o" $(FFLAGS) "render.f90"
modules/render.mod : | modules build/render.o

build/request.o: request.f90 modules/network.mod modules/jessl.mod | modules build
	@echo Compiling request.f90
	@$(FC) -c -o "build/request.o" $(FFLAGS) "request.f90"
modules/request.mod : | modules build/request.o

clean:
	@echo Deleting build/binary.o and related files
	@$(RM) "build/binary.o" "modules/binary.mod" "modules/binary.smod"
	@echo Deleting build/dumb_binary.o and related files
	@$(RM) "build/dumb_binary.o" "modules/dumb_binary.mod" "modules/dumb_binary.smod"
	@echo Deleting build/dumb_render.o and related files
	@$(RM) "build/dumb_render.o" "modules/dumb_render.mod" "modules/dumb_render.smod"
	@echo Deleting build/escape.o and related files
	@$(RM) "build/escape.o" "modules/escaper.mod" "modules/escaper.smod"
	@echo Deleting build/favicon.o and related files
	@$(RM) "build/favicon.o" "modules/favicon.mod"
	@echo Deleting build/favorites.o and related files
	@$(RM) "build/favorites.o" "modules/favorite_handling.mod" "modules/favorite_handling.smod"
	@echo Deleting build/files.o and related files
	@$(RM) "build/files.o" "modules/file_handling.mod" "modules/file_handling.smod"
	@echo Deleting build/history.o and related files
	@$(RM) "build/history.o" "modules/history.mod" "modules/history.smod"
	@echo Deleting build/internal.o and related files
	@$(RM) "build/internal.o" "modules/internal_links.mod" "modules/internal_links.smod"
	@echo Deleting build/jessl.o and related files
	@$(RM) "build/jessl.o" "modules/jessl.mod" "modules/jessl.smod"
	@echo Deleting build/layout.o and related files
	@$(RM) "build/layout.o" "modules/layout.mod" "modules/layout.smod"
	@echo Deleting build/main.o and related files
	@$(RM) "build/main.o"
	@echo Deleting build/network.o and related files
	@$(RM) "build/network.o" "modules/network.mod" "modules/network.smod"
	@echo Deleting build/platform.o and related files
	@$(RM) "build/platform.o" "modules/platform.mod" "modules/platform.smod"
	@echo Deleting build/protocol.o and related files
	@$(RM) "build/protocol.o" "modules/gemini_protocol.mod" "modules/gemini_protocol.smod"
	@echo Deleting build/render.o and related files
	@$(RM) "build/render.o" "modules/render.mod" "modules/render.smod"
	@echo Deleting build/request.o and related files
	@$(RM) "build/request.o" "modules/request.mod" "modules/request.smod"
	@echo Deleting build/sdl_render.o and related files
	@$(RM) "build/sdl_render.o"
	@echo Deleting build/test.o and related files
	@$(RM) "build/test.o"
	@echo Deleting build/test_ssl.o and related files
	@$(RM) "build/test_ssl.o"
	@echo Deleting directory modules
	@rmdir modules
	@echo Deleting directory build
	@rmdir build
	@echo Deleting lr87
	@$(RM) "lr87"

lr87: build/binary.o build/dumb_binary.o build/dumb_render.o build/escape.o build/favicon.o build/favorites.o build/files.o build/history.o build/internal.o build/jessl.o build/layout.o build/main.o build/network.o build/platform.o build/protocol.o build/render.o build/request.o
	@echo Generating lr87
	@$(FC) -o "lr87" build/binary.o build/dumb_binary.o build/dumb_render.o build/escape.o build/favicon.o build/favorites.o build/files.o build/history.o build/internal.o build/jessl.o build/layout.o build/main.o build/network.o build/platform.o build/protocol.o build/render.o build/request.o $(LDIR) $(PRJ_LFLAGS)

all: lr87 

$(DESTDIR)/bin/lr87: lr87
	mkdir -p $(DESTDIR)/bin
	cp lr87 $(DESTDIR)/bin
$(DESTDIR)/share/lr87/LICENSE.txt: LICENSE.txt
	mkdir -p $(DESTDIR)/share/lr87
	cp LICENSE.txt $(DESTDIR)/share/lr87
$(DESTDIR)/share/lr87/README.md: README.md
	mkdir -p $(DESTDIR)/share/lr87
	cp README.md $(DESTDIR)/share/lr87

$(ZIPFILE): 
	zip -9 $(ZIPFILE) *.f90 makefile.gnu LICENSE.txt README.md gemini.prj gemini-windows.prj -x tes*.f90

zip: $(ZIPFILE)

install: $(DESTDIR)/bin/lr87 $(DESTDIR)/share/lr87/LICENSE.txt $(DESTDIR)/share/lr87/README.md