/[PAMELA software]/DarthVader/AnticounterLevel2/Makefile
ViewVC logotype

Annotation of /DarthVader/AnticounterLevel2/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (hide annotations) (download)
Fri Oct 10 13:35:00 2014 UTC (10 years, 2 months ago) by mocchiut
Branch: MAIN
Changes since 1.20: +1 -1 lines
10RED: NO_UNSIGNED_SUBTRACTION bug in MySQL >=5.5.5 fixed

1 mocchiut 1.1 # AC flight analysis software
2     # SOFTWARE VERSION
3 mocchiut 1.21 VER= v2r06
4 mocchiut 1.14 #
5     include ../Make.def
6 mocchiut 1.1 # Here the variables definig the local directories
7     DIRTOP=${shell pwd}
8     DIRLIB=../lib/${ARCH}
9     DIRBIN=../bin/${ARCH}
10     DIRSRC=src
11     DIRINC=inc
12     DIRDOC=doc
13     DIRMACROS=macros
14     DIRCALIB=calib
15     # Here the PAMELA environmental variables to be checked
16     PAM_ENV= PAM_BIN_env PAM_LIB_env PAM_INC_env PAM_DOC_env PAM_YODA_env
17    
18     # Here the local variables used to build the targets
19     # -- F77 - no libraries --
20     FSRCS=
21     FOBJS=
22    
23     # -- CPP - no libraries --
24     CPPSRCS=
25     CPPOBJS=$(CPPSRCS:${DIRSRC}%.cpp=${DIRLIB}%.o)
26    
27     # -- C - no libraries --
28     CSRCS=
29     COBJS=$(CSRCS:${DIRSRC}%.c=${DIRLIB}%.o)
30    
31     # -- CPP - ROOT libraries --
32     LIBROOTSRCS=${DIRSRC}/AcLevel2.cpp
33    
34     LIBROOTLIBS=$(LIBROOTSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
35     LIBROOTCLIBS=libAcLevel2
36     FULLROOTCLIBS=$(LIBROOTCLIBS:%=${DIRLIB}/%_${VER}.so)
37    
38     # -- CPP - NON-ROOT libraries --
39     LIBCPPSRCS=${DIRSRC}/AcCore.cpp \
40     ${DIRSRC}/AcVerl2.cpp
41     LIBCPPLIBS=$(LIBCPPSRCS:${DIRSRC}/%.cpp=${DIRLIB}/lib%_${VER}.so)
42     LIBCPPCLIBS=libAcCore libAcVerl2
43     FULLLIBCPPLIBS=$(LIBCPPCLIBS:%=${DIRLIB}/%_${VER}.so)
44    
45     # -- CPP - Executables --
46     CXXEXESRCS=${DIRSRC}/AnticounterLevel2.cpp
47     CXXEXEOBJS=$(CXXEXESRCS:${DIRSRC}%.cpp=${DIRLIB}%.o)
48     CXXEXELIBS=AnticounterLevel2
49    
50     # -- list of "external" objects needed to link
51 mocchiut 1.4 OTHOBJS=${PAM_LIB}/libGLTables.so ${DIRLIB}/libRunInfo.so
52 mocchiut 1.1
53     # -- directory where to find tracker headers needed to compile
54 mocchiut 1.4 SUBDIR=../RunInfo
55 mocchiut 1.1 SUBINC=$(shell for dir in `echo ${SUBDIR}`; do echo -I$${dir}/inc; done)
56    
57     # List of all libraries we want to install
58     FULLLIBS = ${FULLROOTCLIBS} ${FULLLIBCPPLIBS}
59    
60     # Other objects to install
61     EXESRCS=${DIRBIN}/AnticounterLevel2
62    
63 pam-fi 1.3 INCSRCS=${DIRINC}/AcLevel2.h ${DIRINC}/AcStruct.h
64 mocchiut 1.1
65     MACROSSRCS=
66    
67     CALIBFILES=
68    
69     DOCFILES=
70    
71     # Here the Variables used for info target
72     PACKAGE=Anticounter analysis flight software
73     EXECUTABLES= ${EXESRCS}
74     LIBS= ${FULLLIBS}
75     DOCS=
76     SRCS=
77     #SRCS= ${FSRCS} ${CRSCS} ${CXXEXESRCS} ${LIBROOTSRCS} ${LIBCPPSRCS}
78     MACROS= ${MACROSSRCS}
79     INCLUDE= ${INCSRCS}
80     #
81     TOBEDEL = junk
82     ROOTINC=$$${shell root-config --incdir}
83     NROOTINC=${shell root-config --incdir}
84     # Let's start
85     #all: test mkbindir mklibdir mkverpath ${FOBJS} ${CPPOBJS} ${LIBROOTLIBS} ${LIBCPPLIBS} ${CXXEXELIBS}
86     all: prepare libs
87     all:
88 mocchiut 1.14 # @echo -e ${GREEN} ""
89     # @(${EGREEN} " Finished, now you can install the package \n (use: make install or make upgrade or make forceinstall) "; ${RESET})
90 mocchiut 1.1 @echo -e ${GREEN} ""
91     @${RESET}
92    
93     standalone: all exe
94    
95     prepare: test mkbindir mklibdir mkverpath
96    
97     exe: prepare ${CXXEXELIBS}
98    
99     libs: prepare ${LIBROOTLIBS} ${LIBCPPLIBS}
100    
101 mocchiut 1.14 include ../Make.dect
102 mocchiut 1.1 # A small target to check environmental variables
103     %_env:
104     @${test_env}
105    
106     .PHONY: install installdoc installlib installmacros installinc installexe installcmacro
107     .PHONY: clean depclean info mkbindir mklibdir testcern testpamenv test
108    
109     mkbindir: ${DIRBIN}
110     ${DIRBIN}:
111     @${test_and_mk}
112    
113     mklibdir: ${DIRLIB}
114     ${DIRLIB}:
115     @${test_and_mk}
116    
117     # Here what has to be deleted in clean target
118     clean: TOBEDEL= ${DIRSRC}/*.o ${DIRSRC}/*Dict.cpp ${DIRSRC}/*Dict.h ${FOBJS} ${FULLLIBS} ${DIRBIN}/${CXXEXELIBS} ${CPPOBJS} ${CXXEXEOBJS} ${FULLLINKCLIBS} ${FULLMACROCLIBS} ${FULLLINKMACROCLIBS} ${DIRSRC}/AcVerl2.cpp
119     clean:
120     @${test_and_rm}
121    
122     distclean: clean
123     distclean: TOBEDEL= ${DIRBIN} ${DIRLIB}
124     distclean:
125     @${test_and_rm}
126    
127     forceinstall: FORCE=-f
128     forceinstall: install
129    
130     forceinstallstandalone: FORCE=-f
131     forceinstallstandalone: installstandalone
132    
133     upgrade: FORCE=-u
134     upgrade: install
135    
136     upgradestandalone: FORCE=-u
137     upgradestandalone: installstandalone
138    
139     install: installlib installinc installmacros installcalib installdoc installcmacro
140    
141     installstandalone: install installexe
142    
143     installlib: LINK=y
144     installlib: TOBEMOVED= $(FULLLIBS:${DIRLIB}%=${PAM_LIB}%)
145     installlib: ORIGIN=${DIRLIB}
146     installlib:
147     @${test_and_cp}
148    
149     installcmacro: LINK=y
150     installcmacro: TOBEMOVED= $(FULLMACROCLIBS:${DIRLIB}%=${PAM_LIB}%)
151     installcmacro: ORIGIN=${DIRLIB}
152     installcmacro:
153     @${test_and_cp}
154    
155     installinc: TOBEMOVED= $(INCSRCS:${DIRINC}/%=${PAM_INC}/%)
156     installinc: ORIGIN=${DIRINC}
157     installinc:
158     @${test_and_cp}
159    
160     installexe: TOBEMOVED= $(EXESRCS:${DIRBIN}/%=${PAM_BIN}/%)
161     installexe: ORIGIN=${DIRBIN}
162     installexe:
163     @${test_and_cp}
164    
165     installmacros: TOBEMOVED= $(MACROSSRCS:${DIRMACROS}/%=${PAM_MACROS}/%)
166     installmacros: ORIGIN=${DIRMACROS}
167     installmacros:
168     @${test_and_cp}
169    
170     installcalib: TOBEMOVED= $(CALIBFILES:${DIRCALIB}/%=${PAM_CALIB}/%)
171     installcalib: ORIGIN=${DIRCALIB}
172     installcalib:
173     @${test_and_cp}
174    
175     installdoc: TOBEMOVED= $(DOCFILES:${DIRDOC}/%=${PAM_DOC}/%)
176     installdoc: ORIGIN=${DIRDOC}
177     installdoc:
178     @${test_and_cp}
179    
180     mkverpath:
181 pam-fi 1.15 @echo '#include <TSystem.h>' > ${DIRTOP}/${DIRSRC}/AcVerl2.cpp; echo 'const char *AcInfo(bool print){ if ( print ) printf("\nAnticounter Level2 flight package version: ${VER}\n\nCompiled on '${TODAY}' with: '${GCCVER}'\n\nOn: '${UNAMEA}'\n\n"); return("${VER}"); }' >> ${DIRTOP}/${DIRSRC}/AcVerl2.cpp
182 mocchiut 1.1 @sleep 0.8
183    
184    
185    
186     info:
187     @echo " "
188     @${EGREEN} "Infos for package :" ${WHITE} ${PACKAGE}
189     @${EGREEN} " VERSION :" ${WHITE} ${VER}
190     @${EGREEN} " EXECUTABLES :" ${WHITE} ${EXECUTABLES}
191     @${EGREEN} " LIBS :" ${WHITE} ${LIBS}
192     @${EGREEN} " DOCS :" ${WHITE} ${DOCS}
193     @${EGREEN} " SRCS :" ${WHITE} ${SRCS}
194     @${EGREEN} " MACROS :" ${WHITE} ${MACROS}
195     @${EGREEN} " INCLUDE :" ${WHITE} ${INCLUDE}
196     @echo " "
197     @${RESET}
198    
199     test: testpamenv
200    
201     testpamenv: ${PAM_ENV}
202    
203     root-config: OPT=--cflags
204     root-config:
205     @${test_cmd}
206    
207     # Here follows some usefull macros
208     define test_and_cp
209     wd=`pwd`;\
210     for i in ${TOBEMOVED} ; do \
211     wv=$${i##/*/}; \
212     dest=$${i/$${wv}/}; \
213     ${EGREEN} "Testing for :" ${WHITE} "$${i}" ; ${RESET}; \
214     if [ ! "${FORCE}" ] ; then \
215     if [ ! -f $${i} ]; then \
216     ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
217     ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
218     cp ${ORIGIN}/$${i##/*/} $${i}; \
219     else \
220     ${ERED} "File already exist !!!! Please delete it " ${WHITE}; ${RESET}; \
221     fi;\
222     else \
223     if [ "${FORCE}" == "-u" ] ; then \
224     if [ "`basename $${i}`" != "`basename $${i} _${VER}.so`" ]; then \
225     ${EYELLOW} "Removing: "${WHITE} ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so; ${RESET}; \
226     rm -f ${PAM_LIB}/`basename $${i} _${VER}.so`_v*r*.so ; \
227     ${EGREEN} "Copying : "${WHITE} ${ORIGIN}/$${i##/*/} ;\
228     ${EGREEN} " to: "${WHITE} $${i} ; ${RESET}; \
229     cp ${ORIGIN}/$${i##/*/} $${i}; \
230     else \
231     ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
232     ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
233     cp -f ${ORIGIN}/$${i##/*/} $${i}; \
234     fi; \
235     else \
236     ${EYELLOW} " Forcing copy: "${WHITE} ${ORIGIN}/$${i##/*/} ;\
237     ${EYELLOW} " to: "${WHITE} $${i} ; ${RESET}; \
238     cp ${FORCE} ${ORIGIN}/$${i##/*/} $${i}; \
239     fi;\
240     fi ;\
241     if [ ! -z ${LINK} ] ; then \
242     ${EGREEN} "Creating symlink from : "${WHITE} $${wv/_${VER}/} ;\
243     ${EGREEN} " to : "${WHITE} $${i##/*/} ; ${RESET}; \
244     cd $${dest}; \
245     ln -sf $${wv} $${wv/_${VER}/}; \
246     cd $${wd}; \
247     fi \
248     done
249     endef
250    
251     define test_and_mk
252     ${EGREEN} "Testing for :" ${WHITE} "$@"; ${RESET}
253     test -d "$@" || \
254     (${EGREEN} "Creating : "${WHITE} "$@"; ${RESET}; mkdir -p $@)
255     endef
256    
257     define test_env
258     ${EGREEN} "Testing for env:" ${WHITE} $(patsubst %_env,%,$@); ${RESET}
259     printenv $(patsubst %_env,%,$@) 1>/dev/null || \
260     (${ERED} "ERROR, variable : "${WHITE} $(patsubst %_env,%,$@) \
261     ${RED} "not defined !!! Check your env. settings"; \
262     ${RESET}; exit 1)
263     ${EGREEN} " Defined:" ${WHITE} $${$(patsubst %_env,%,$@)}; ${RESET}
264     endef
265    
266     define test_cmd
267     ${EGREEN} "Testing for cmd:" ${WHITE} $@ ${OPT}; ${RESET}
268     $@ ${OPT} 1>/dev/null 2>&1 || \
269     (${ERED} "ERROR, command : "${WHITE} $@ ${OPT}\
270     ${RED} "not found !!! Check your installation"; \
271     ${RESET}; exit 1)
272     ${EGREEN} " Present:" ${WHITE} $@ ${OPT}; ${RESET}
273     endef
274    
275     define test_and_rm
276     for i in ${TOBEDEL}; do \
277     test -d $${i} || (${ERED} "Removing file :"${WHITE} $${i}; ${RESET}; \
278     rm -f $${i} ); \
279     test ! -d $${i} || (${ERED} "Removing dir :"${WHITE} $${i}; ${RESET}; \
280     rm -rf $${i} ); \
281     done
282     endef

  ViewVC Help
Powered by ViewVC 1.1.23