summaryrefslogtreecommitdiff
path: root/src/makefile
blob: 8817e3839db8da281a11079f55c5ee4b6eee2094 (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
 #########################################################################
 #
 # HTCd - Copyright (C) 1998-2006 Henrik Rydberg
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #

LIBRARY	= libhtc.a
INSTALL = ../bin

############################################################################

MODULE += mt
mt_c  	= test
mt_o  	= cfind crfind strip \
	sfind srfind sfindtab srfindtab scomptab sconvert \
	find_of rfind_of find_not_of rfind_not_of skip_parentesis \
	stringref mstream mread mstring mset msmap \
	random dates lock lookup issue config


MODULE += mime
mime_c	= test
mime_o 	= mime def mailbox base64 qp pack


MODULE += mail
mail_c	= inbox move list


MODULE += http
http_c	= test
http_o	= mime req resp


MODULE += ops
ops_c	= test
ops_o  	= operator express basic comp string latex


MODULE += hdb
hdb_c	= test hdbtest hdbcvt hdbfix
hdb_o  	= filemap sortable db comp cvt


MODULE += hed
hed_c	= test hed
hed_o  	= input edit tables
hed_x	= hed


MODULE += lang
lang_c	= test
lang_o 	= token env parse ops basic func latex help flow db lang


MODULE += sh
sh_c	= htc
sh_o   	= file convert dates user tree sys net main
sh_x	= htc

MODULE += serv
serv_c	= htcs
serv_o 	= direct request const auth form tempmap main
serv_x	= htcs

MODULE += net
net_c	= test htcd redirect route80
net_o  	= isocket server thrserv
net_x	= htcd redirect

MODULE += labat
labat_c = atomlab
labat_f = labat
labat_o	= resten deriv grad grabgr laplac laplac2 ggaexc \
	exchen ldaec gcor ggaec ggauxc exchpt ldauc \
	ggauc spline splint
labat_x	= atomlab labat

############################################################################

CTARGET	= $(foreach mod,$(MODULE),\
	$(addprefix $(mod)/,$($(mod)_c)))

FTARGET	= $(foreach mod,$(MODULE),\
	$(addprefix $(mod)/,$($(mod)_f)))

LTARGET = $(foreach mod,$(MODULE),\
	$(addprefix $(mod)/,$($(mod)_o)))

XTARGET = $(foreach mod,$(MODULE),\
	$(addprefix $(mod)/,$($(mod)_x)))

XLIST 	= $(foreach mod,$(MODULE),$($(mod)_x))

CTARG	= $(addprefix tmp/bin/,$(CTARGET))
FTARG	= $(addprefix tmp/bin/,$(FTARGET))
XTARG	= $(addprefix tmp/bin/,$(XTARGET))
COBJ	= $(addprefix tmp/obj/c/,$(addsuffix .o,$(CTARGET)))
FOBJ	= $(addprefix tmp/obj/f/,$(addsuffix .o,$(FTARGET)))
LOBJ	= $(addprefix tmp/obj/l/,$(addsuffix .o,$(LTARGET)))
TLIB	= $(addprefix tmp/obj/,$(LIBRARY))

############################################################################

INCLUDE = -I.
COPT	= -O3 -pthread
FOPT	= -O5
CLIBS	= -lncurses
FLIBS	=

.PHONY: all man html clean mkobj install
.PRECIOUS: tmp/obj/c/%.o tmp/obj/f/%.o tmp/obj/l/%.o

############################################################################

all:		$(LOBJ) $(TLIB) $(FOBJ) $(COBJ) $(FTARG) $(CTARG) 

tmp/bin/%:	tmp/obj/c/%.o $(TLIB)
		@mkdir -p $(@D)
		g++ $(COPT) $< $(TLIB) $(CLIBS) -o $@

tmp/bin/%:	tmp/obj/f/%.o $(TLIB)
		@mkdir -p $(@D)
		gfortran $(FOPT) $< $(TLIB) $(FLIBS) -o $@

tmp/obj/c/%.o:	%.cc
		@mkdir -p $(@D)
		gcc $(INCLUDE) $(COPT) -c $< -o $@

tmp/obj/f/%.o:	%.f
		@mkdir -p $(@D)
		gfortran $(FOPT) -c $< -o $@

$(TLIB):	$(LOBJ)
		@rm -f $(TLIB)
		ar qc $(TLIB) $(LOBJ)

tmp/obj/l/%.o:	%.cc
		@mkdir -p $(@D)
		gcc $(INCLUDE) $(COPT) -c $< -o $@

tmp/obj/l/%.o:	%.f
		@mkdir -p $(@D)
		gfortran $(FOPT) -c $< -o $@

man:
		@rm -rf tmp/man
		doxygen etc/doxman

html:
		@rm -rf tmp/html
		doxygen etc/doxhtml

install:	$(XTARG)
		@mkdir -p $(INSTALL)
		cp -rfp $(XTARG) $(INSTALL)

clean:
		rm -rf tmp

distclean:
		rm -rf tmp; cd $(INSTALL); rm -rf $(XLIST)

############################################################################