Generate progs.h from a bunch of files instead of internal knowledge
[openssl.git] / apps / Makefile.in
1 #
2 #  apps/Makefile
3 #
4
5 DIR=            apps
6 TOP=            ..
7 CC=             cc
8 INCLUDES=       -I$(TOP) -I../crypto -I../include
9 CFLAG=          -g -static -Wswitch
10 MAKEFILE=       Makefile
11 PERL=           perl
12 RM=             rm -f
13
14 PLIB_LDFLAG=
15 EX_LIBS= 
16 EXE_EXT= 
17
18 SHLIB_TARGET=
19
20 CFLAGS= $(INCLUDES) $(CFLAG)
21
22 GENERAL=Makefile makeapps.com install.com
23
24 DLIBCRYPTO=../libcrypto.a
25 DLIBSSL=../libssl.a
26 LIBCRYPTO=-L.. -lcrypto
27 LIBSSL=-L.. -lssl
28
29 SCRIPTS=CA.pl tsget
30 EXE= openssl$(EXE_EXT)
31
32 COMMANDS= \
33         asn1pars.o ca.o ciphers.o cms.o crl.o crl2p7.o dgst.o dhparam.o \
34         dsa.o dsaparam.o ec.o ecparam.o enc.o engine.o errstr.o gendsa.o \
35         genpkey.o genrsa.o nseq.o ocsp.o passwd.o pkcs12.o pkcs7.o pkcs8.o \
36         pkey.o pkeyparam.o pkeyutl.o prime.o rand.o req.o rsa.o rsautl.o \
37         s_client.o s_server.o s_time.o sess_id.o smime.o speed.o spkac.o \
38         srp.o ts.o verify.o version.o x509.o rehash.o
39
40 EXTRA_OBJ=apps.o opt.o s_cb.o s_socket.o
41 EXTRA_SRC=apps.c opt.c s_cb.c s_socket.c
42 RAND_OBJ=app_rand.o
43 RAND_SRC=app_rand.c
44
45 OBJ     = $(COMMANDS)
46
47 SRC     = \
48         asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c dhparam.c \
49         dsa.c dsaparam.c ec.c ecparam.c enc.c engine.c errstr.c gendsa.c \
50         genpkey.c genrsa.c nseq.c ocsp.c passwd.c pkcs12.c pkcs7.c pkcs8.c \
51         pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c rsa.c rsautl.c \
52         s_client.c s_server.c s_time.c sess_id.c smime.c speed.c spkac.c \
53         srp.c ts.c verify.c version.c x509.c rehash.c
54
55 EXE_OBJ = openssl.o $(OBJ) $(EXTRA_OBJ) $(RAND_OBJ)
56 EXE_SRC = openssl.c $(SRC) $(EXTRA_SRC) $(RAND_SRC)
57
58 HEADER= apps.h progs.h s_apps.h \
59         testdsa.h testrsa.h timeouts.h
60
61 ALL=    $(GENERAL) $(EXE_SRC) $(HEADER)
62
63 top:
64         @(cd ..; $(MAKE) DIRS=$(DIR) all)
65
66 all:    exe scripts
67
68 exe:    $(EXE)
69
70 scripts: $(SCRIPTS)
71
72 openssl-vms.cnf: openssl.cnf
73         $(PERL) $(TOP)/VMS/VMSify-conf.pl < openssl.cnf > openssl-vms.cnf
74
75 files:
76         $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
77
78 install:
79         @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
80         @set -e; for i in $(EXE); \
81         do  \
82         (echo installing $$i; \
83          cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
84          chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
85          mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
86          done;
87         @set -e; for i in $(SCRIPTS); \
88         do  \
89         (echo installing $$i; \
90          cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
91          chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
92          mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
93          done
94         @cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
95         chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
96         mv -f  $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
97
98 uninstall:
99         @set -e; for i in $(EXE); \
100         do  \
101                 echo $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
102                 $(RM) $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i; \
103         done;
104         @set -e; for i in $(SCRIPTS); \
105         do  \
106                 echo $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
107                 $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i; \
108         done
109         $(RM) $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
110
111 generate: openssl-vms.cnf progs.h
112
113 depend:
114         $(TOP)/util/domd $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(EXE_SRC)
115
116 clean:
117         rm -f *.o *.obj *.dll lib tags core .pure .nfs* *.old *.bak fluff $(EXE)
118         rm -f req
119
120 $(DLIBSSL):
121         (cd ..; $(MAKE) build_libssl)
122
123 $(DLIBCRYPTO):
124         (cd ..; $(MAKE) build_libcrypto)
125
126 $(EXE): $(EXE_OBJ) $(DLIBCRYPTO) $(DLIBSSL)
127         $(RM) $(EXE)
128         shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
129                 shlib_target="$(SHLIB_TARGET)"; \
130         fi; \
131         LIBRARIES="$(LIBSSL) $(LIBCRYPTO)" ; \
132         $(MAKE) -f $(TOP)/Makefile.shared -e \
133                 APPNAME=$(EXE) OBJECTS="$(EXE_OBJ)" \
134                 LDFLAG="$(LDFLAG)" \
135                 LIBDEPS="$(PLIB_LDFLAG) $$LIBRARIES $(EX_LIBS)" \
136                 link_app.$${shlib_target}
137
138 progs.h: progs.pl Makefile.in
139         $(RM) progs.h
140         $(PERL) progs.pl $(EXE_SRC) > progs.h
141
142 CA.pl: CA.pl.in
143         $(PERL) -I$(TOP) -Mconfigdata $(TOP)/util/dofile.pl -oapps/Makefile CA.pl.in > CA.pl.new
144         mv CA.pl.new CA.pl
145
146
147 # DO NOT DELETE THIS LINE -- make depend depends on it.