Back Midas Rome Roody Rootana
  Midas DAQ System, Page 125 of 137  Not logged in ELOG logo
ID Date Authordown Topic Subject
  14   22 Jun 2004 Exaos Lee FAQ: anonymous cvs access?
> In the Midas doc under "Quick Start"
> http://midas.triumf.ca/doc/html/quickstart.html
> you will find the proper cvs command for accessing the latest cvs Midas
> version. The public pwd is cvs. You will only be able to checkout/update the
> package.

I cannot checkout module:
------------
01:52:16: pc2075.psi.ch: Operation timed out
01:52:16: cvs [checkout aborted]: end of file from server (consult above
messages if any)
------------

Could anybody add download tar package in the WWW interface of CVS repository.
I know the original CGI script has such a feature. Thanks.
  53   23 Jun 2004 Exaos Lee How to compile under Darwin-gcc? (MacOS X)
> The current (cvs) version of MIDAS should build on Mac OS X right out of the
> box- I fixed all the problems you report back in February(?)- see the macosx
> thread in this forum. A few weeks ago I verified that it still compiles on Mac
> OS 10.3.4. The Mac OS port received minimal testing- I checked that "odbedit"
> and "mhttpd" run, that's about it. K.O.
> 

Thanks a lot. But I cannot checkout module:
------------
01:52:16: pc2075.psi.ch: Operation timed out
01:52:16: cvs [checkout aborted]: end of file from server (consult above
messages if any)
------------

Could anybody add download tar package in the WWW interface of CVS repository.
I know the original CGI script has such a feature. Thanks.

P.S.
I use these commands to checkout:
   cvs -e ssh -d :ext:cvs@midas.psi.ch:/usr/local/cvsroot checkout midas
   cvs -e ssh -d :ext:cvs@midas.psi.ch:/usr/local/cvsroot update
  55   23 Jun 2004 Exaos Lee How to compile under Darwin-gcc? (MacOS X)
> 
> Should work fine, just tried from outside PSI. Please check again.

Unfortunately, I still encounter the same problem. 
---
pc2075.psi.ch: Operation timed out
cvs [checkout aborted]: end of file from server (consult above messages if any)
---

I am in LNS-INFN (Italy), i.e., I am outside PSI. So ... what's the problem? I try to
ping the host, and it is reachable:
--------
[exaos@exaos cvsnew]$ ping midas.psi.ch
PING pc2075.psi.ch (129.129.228.23): 56 data bytes
64 bytes from 129.129.228.23: icmp_seq=0 ttl=50 time=67.237 ms
64 bytes from 129.129.228.23: icmp_seq=1 ttl=50 time=64.202 ms
64 bytes from 129.129.228.23: icmp_seq=2 ttl=50 time=56.278 ms
...
--------
Is it the problem of firewall? I am not sure. So strange.

> 
> The tar package is only done for a new release (which will happen in the next days
> BTW), so http://midas.psi.ch/download/tar/ contains the most recent packages. Upon
> request I make a midas-snapshot.tar.gz, but since there will be a 1.9.4 soon, it's
> maybe not necessary right now.

Waiting for the new release ...
  56   28 Jun 2004 Exaos Lee Linking Error: g++ -rpath?
I cannot checkout from the cvs server. So I download each latest file from the WWW
interface of CVS. While compiling these files, I encountered the following problems:
-------------
...
g++ -DHAVE_ROOT -c -g -O2 -Wall -Iinclude -Idrivers -Ldarwin/lib -DINCLUDE_FTPLIB  
-DOS_LINUX -DOS_DARWIN -DHAVE_STRLCPY -fPIC -Wno-unused-function -D_REENTRANT
-I/sw/include -I/opt/root/current/include -Wl,-rpath,/opt/root/current/lib -o
darwin/lib/rmana.o src/mana.c
g++: -rpath: linker input file unused because linking not done
g++: /opt/root/current/lib: linker input file unused because linking not done
...
g++ -g -O2 -Wall -Iinclude -Idrivers -Ldarwin/lib -DINCLUDE_FTPLIB   -DOS_LINUX
-DOS_DARWIN -DHAVE_STRLCPY -fPIC -Wno-unused-function -DHAVE_ROOT -D_REENTRANT
-I/sw/include -I/opt/root/current/include -Wl,-rpath,/opt/root/current/lib -o
darwin/bin/mlogger src/mlogger.c darwin/lib/libmidas.a -L/opt/root/current/lib -u
_G__cpp_setupG__Hist -u _G__cpp_setupG__Graf1 -u _G__cpp_setupG__G3D -u
_G__cpp_setupG__GPad -u _G__cpp_setupG__Tree -u _G__cpp_setupG__Rint -u
_G__cpp_setupG__PostScript -u _G__cpp_setupG__Matrix -u _G__cpp_setupG__Quadp -u
_G__cpp_setupG__Physics -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint
-lPostscript -lMatrix -lQuadp -lPhysics -lpthread -lm -L/sw/lib -ldl -lpthread
ld: unknown flag: -rpath
gmake: *** [darwin/bin/mlogger] Error 1
---------------
What does '-rpath' mean? It is just a linking error. Thanks.
  46   14 Jul 2004 Exaos Lee install problem of Makefile on MacOS X (Darwin 7.4.0, gcc 3.3)
I have compiled the sources on Darwin 7.4.0 with gcc 3.3. After the compilation of source codes, I 
try to execute "gmake install". I got the following message:
-------
Nothing to be done for "install".
-------

The install target could not be executed. Then I add the following line to the Makefile:
------
.PHONY: install
------

The install target can be executed. But when it is tring to copy "dio" to the proper directory, it 
cannot find the file. Then I found that the "utils" target isn't built. 
I try to build the target: darwin/bin/dio, I got the following error:
-------
cc -g -O2 -Wall -Iinclude -Idrivers -Ldarwin/lib -DINCLUDE_FTPLIB   -DOS_LINUX -DOS_DARWIN 
-DHAVE_STRLCPY -fPIC -Wno-unused-function -o darwin/bin/dio utils/dio.c
utils/dio.c:39:20: sys/io.h: No such file or directory
utils/dio.c: In function `main':
utils/dio.c:46: warning: implicit declaration of function `iopl'
gmake: *** [darwin/bin/dio] Error 1
--------
So, the include file "sys/io.h" may be changed under Darwin. I don't know how. I will try later. I 
hope somebody can notice this. 
Best regards.
  47   14 Jul 2004 Exaos Lee install problem of Makefile on MacOS X (Darwin 7.4.0, gcc 3.3)
There are not such a file "io.h" inside my MacOS X. In fact, I didn't find any file containing function iopl().
So what is the equivalent function of iopl() under MacOS X? The utility dio should be modified in order to be compiled under Darwin-
gcc platform. 
  228   15 Oct 2005 Exaos LeeInfoBus drivers moved in repository
The Makefile should be modified too. Please see the diff below:
diff Makefile Makefile.modify
-------------------------------------
404,405c404,405
< $(BIN_DIR)/mcnaf: $(UTL_DIR)/mcnaf.c $(DRV_DIR)/bus/camacrpc.c
<       $(CC) $(CFLAGS) $(OSFLAGS) -o $@ $(UTL_DIR)/mcnaf.c $(DRV_DIR)/bus/camacrpc.c $(LIB) $(LIBS)
---
> $(BIN_DIR)/mcnaf: $(UTL_DIR)/mcnaf.c $(DRV_DIR)/camac/camacrpc.c
>       $(CC) $(CFLAGS) $(OSFLAGS) -o $@ $(UTL_DIR)/mcnaf.c $(DRV_DIR)/camac/camacrpc.c $(LIB) $(LIBS)
  229   17 Oct 2005 Exaos LeeBug Fix"make install" error under MacOS X
Under MacOS X, "make install" will cours an error like this:
...
install: darwin/bin/dio: No such file or directory
make: *** [install] Error 71

This can be fixed as the following diff:
404,405c404,405
< $(BIN_DIR)/mcnaf: $(UTL_DIR)/mcnaf.c $(DRV_DIR)/camac/camacrpc.c
<       $(CC) $(CFLAGS) $(OSFLAGS) -o $@ $(UTL_DIR)/mcnaf.c $(DRV_DIR)/camac/camacrpc.c $(LIB) $(LIBS)
---
> $(BIN_DIR)/mcnaf: $(UTL_DIR)/mcnaf.c $(DRV_DIR)/bus/camacrpc.c
>       $(CC) $(CFLAGS) $(OSFLAGS) -o $@ $(UTL_DIR)/mcnaf.c $(DRV_DIR)/bus/camacrpc.c $(LIB) $(LIBS)
438c438,439
<       @for i in mserver mhttpd odbedit mlogger ; \
---
> 
>       @for i in mserver mhttpd odbedit mlogger dio ; \
444,447d444
<       chmod +s $(SYSBIN_DIR)/mhttpd
< 
< ifeq ($(OSTYPE),linux)
<       install -v -m 755 $(BIN_DIR)/dio $(SYSBIN_DIR)
449c446
< endif
---
>       chmod +s $(SYSBIN_DIR)/mhttpd
  311   16 Oct 2006 Exaos LeeBug FixBuild error with mana.c while using CERNLIB, svn 3366
If you use CERNLIB to build hmana.o, you may encounter the following error:
src/mana.c: In function ‘write_event_hbook’:
src/mana.c:2881: error: invalid assignment
or somthing like this:
src/mana.c: In function ‘write_event_hbook’:
src/mana.c:2881: warning: target of assignment not really an lvalue; this will be a hard error in the future
So I checked the mana.c and found these lines
2880            /* shift data pointer to next item */
2881            (char *) pdata += key.item_size * key.num_values;
should be changed to
2880            /* shift data pointer to next item */
2881            pdata += key.item_size * key.num_values * sizeof(char) ;
  312   16 Oct 2006 Exaos LeeBug Fix"make install" error on MacOS 10.4.7, svn 3366
While executing "make install" under MacOS 10.4.7, you may encounter errors about "dio". It is the 
problem of "Makefile". I did some change to it and attach the diff file here.
Attachment 1: Makefile.diff
461,463c461,463
< 	chmod +s $(SYSBIN_DIR)/dio
< 	chmod +s $(SYSBIN_DIR)/mhttpd
< 	chmod +s $(SYSBIN_DIR)/webpaw
---
> 	if [ -f $(SYSBIN_DIR)/dio ]; then chmod +s $(SYSBIN_DIR)/dio ; fi
> 	if [ -f $(SYSBIN_DIR)/mhttpd ]; then chmod +s $(SYSBIN_DIR)/mhttpd; fi
> 	if [ -f $(SYSBIN_DIR)/webpaw ]; then chmod +s $(SYSBIN_DIR)/webpaw; fi
521c521
< 	@for i in mserver mhttpd dio ; \
---
> 	@for i in mserver mhttpd; \
525a526,528
> ifeq ($(OSTYPE),linux)
> 	install -v -m 755 $(BIN_DIR)/dio $(SYSBIN_DIR)
> endif
527,528c530,531
< 	chmod +s $(SYSBIN_DIR)/dio
< 	chmod +s $(SYSBIN_DIR)/mhttpd
---
> 	if [ -f $(SYSBIN_DIR)/dio ]; then chmod +s $(SYSBIN_DIR)/dio; fi
> 	if [ -f $(SYSBIN_DIR)/mhttpd ]; then chmod +s $(SYSBIN_DIR)/mhttpd; fi
  334   02 Feb 2007 Exaos LeeBug ReportCompiling failed with SVN3562 under Ubuntu 6.10
The error log is as the following:
cc -c -g -O2 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_MYSQL -DHAVE_ROOT -pthread -I/opt/root/current/include -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/system.o src/system.c
src/system.c:958: error: expected declaration specifiers or ‘...’ before ‘gettid’
src/system.c:958: warning: data definition has no type or storage class
src/system.c:958: warning: type defaults to ‘int’ in declaration of ‘_syscall0’
src/system.c: In function ‘ss_gettid’:
src/system.c:1005: warning: implicit declaration of function ‘gettid’
src/system.c: In function ‘ss_suspend_init_ipc’:
src/system.c:2948: warning: pointer targets in passing argument 3 of ‘getsockname’ differ in signedness
src/system.c: In function ‘ss_suspend’:
src/system.c:3414: warning: pointer targets in passing argument 6 of ‘recvfrom’ differ in signedness
src/system.c:3441: warning: pointer targets in passing argument 6 of ‘recvfrom’ differ in signedness
make: *** [linux/lib/system.o] &#38169;&#35823; 1

The error might be here:
void ss_force_single_thread()
{
   _single_thread = TRUE;
}

#if defined(OS_DARWIN)
// blank
#elif defined(OS_LINUX)
_syscall0(pid_t,gettid);
#endif

INT ss_gettid(void)

I have no idea about the usage of _syscall0(...).
  335   02 Feb 2007 Exaos LeeBug ReportCompiling failed with SVN3562 under Ubuntu 6.10
I tried to solve the problem by adding a ";". It was wrong. In fact, the macro "_syscall0(..)" doesn't need the ";".
I searched and found that somebody said "the overall _syscall$magicnumber will disappear". I don't mind whether the "_syscall" disappear or not. I just want to compile the code and do my job. I deleted the additional ";" and recompiled. The error output is as the attachment [elog:335/1].
Attachment 1: err.log
cc -c -g -O2 -Wall -Wuninitialized -Iinclude -Idrivers -I../mxml -Llinux/lib -DINCLUDE_FTPLIB   -D_LARGEFILE64_SOURCE -DHAVE_MYSQL -DHAVE_ROOT -pthread -I/opt/root/current/include -DOS_LINUX -fPIC -Wno-unused-function -o linux/lib/system.o src/system.c
src/system.c:958: error: expected declaration specifiers or ‘...’ before ‘gettid’
src/system.c:961: warning: return type defaults to ‘int’
src/system.c: In function ‘_syscall0’:
src/system.c:978: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1019: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1050: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1165: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1380: error: storage class specified for parameter ‘_daemon_flag’
src/system.c:1400: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1462: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1495: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1532: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1621: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1695: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1731: error: storage class specified for parameter ‘skip_mutex_handle’
src/system.c:1731: error: parameter ‘skip_mutex_handle’ is initialized
src/system.c:1760: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:1915: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2024: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2110: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2181: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2248: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2277: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2341: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2379: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2393: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2413: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2484: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2546: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2644: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2751: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2807: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:2871: error: storage class specified for parameter ‘SUSPEND_STRUCT’
src/system.c:2873: error: expected declaration specifiers before ‘SUSPEND_STRUCT’
src/system.c:2896: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3002: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3072: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3132: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3187: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3235: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3493: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3547: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3606: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3682: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3775: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:3901: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4080: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4167: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4210: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4297: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4356: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4430: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4497: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4558: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4615: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4667: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4723: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4779: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4826: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4887: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:4980: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5049: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5069: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5093: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5171: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5222: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5258: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5313: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5379: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5645: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5668: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5707: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5769: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5853: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
src/system.c:5883: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
In file included from /usr/include/math.h:71,
                 from src/system.c:5897:
/usr/include/bits/mathcalls.h:55: error: storage class specified for parameter ‘acos’
/usr/include/bits/mathcalls.h:55: error: storage class specified for parameter ‘__acos’
/usr/include/bits/mathcalls.h:57: error: storage class specified for parameter ‘asin’
/usr/include/bits/mathcalls.h:57: error: storage class specified for parameter ‘__asin’
/usr/include/bits/mathcalls.h:59: error: storage class specified for parameter ‘atan’
/usr/include/bits/mathcalls.h:59: error: storage class specified for parameter ‘__atan’
/usr/include/bits/mathcalls.h:61: error: storage class specified for parameter ‘atan2’
/usr/include/bits/mathcalls.h:61: error: storage class specified for parameter ‘__atan2’
/usr/include/bits/mathcalls.h:64: error: storage class specified for parameter ‘cos’
/usr/include/bits/mathcalls.h:64: error: storage class specified for parameter ‘__cos’
/usr/include/bits/mathcalls.h:66: error: storage class specified for parameter ‘sin’
/usr/include/bits/mathcalls.h:66: error: storage class specified for parameter ‘__sin’
/usr/include/bits/mathcalls.h:68: error: storage class specified for parameter ‘tan’
/usr/include/bits/mathcalls.h:68: error: storage class specified for parameter ‘__tan’
/usr/include/bits/mathcalls.h:73: error: storage class specified for parameter ‘cosh’
/usr/include/bits/mathcalls.h:73: error: storage class specified for parameter ‘__cosh’
/usr/include/bits/mathcalls.h:75: error: storage class specified for parameter ‘sinh’
/usr/include/bits/mathcalls.h:75: error: storage class specified for parameter ‘__sinh’
/usr/include/bits/mathcalls.h:77: error: storage class specified for parameter ‘tanh’
/usr/include/bits/mathcalls.h:77: error: storage class specified for parameter ‘__tanh’
/usr/include/bits/mathcalls.h:89: error: storage class specified for parameter ‘acosh’
/usr/include/bits/mathcalls.h:89: error: storage class specified for parameter ‘__acosh’
/usr/include/bits/mathcalls.h:91: error: storage class specified for parameter ‘asinh’
/usr/include/bits/mathcalls.h:91: error: storage class specified for parameter ‘__asinh’
/usr/include/bits/mathcalls.h:93: error: storage class specified for parameter ‘atanh’
/usr/include/bits/mathcalls.h:93: error: storage class specified for parameter ‘__atanh’
/usr/include/bits/mathcalls.h:101: error: storage class specified for parameter ‘exp’
/usr/include/bits/mathcalls.h:101: error: storage class specified for parameter ‘__exp’
/usr/include/bits/mathcalls.h:104: error: storage class specified for parameter ‘frexp’
/usr/include/bits/mathcalls.h:104: error: storage class specified for parameter ‘__frexp’
/usr/include/bits/mathcalls.h:107: error: storage class specified for parameter ‘ldexp’
/usr/include/bits/mathcalls.h:107: error: storage class specified for parameter ‘__ldexp’
/usr/include/bits/mathcalls.h:110: error: storage class specified for parameter ‘log’
/usr/include/bits/mathcalls.h:110: error: storage class specified for parameter ‘__log’
/usr/include/bits/mathcalls.h:113: error: storage class specified for parameter ‘log10’
/usr/include/bits/mathcalls.h:113: error: storage class specified for parameter ‘__log10’
/usr/include/bits/mathcalls.h:116: error: storage class specified for parameter ‘modf’
/usr/include/bits/mathcalls.h:116: error: storage class specified for parameter ‘__modf’
/usr/include/bits/mathcalls.h:129: error: storage class specified for parameter ‘expm1’
/usr/include/bits/mathcalls.h:129: error: storage class specified for parameter ‘__expm1’
/usr/include/bits/mathcalls.h:132: error: storage class specified for parameter ‘log1p’
/usr/include/bits/mathcalls.h:132: error: storage class specified for parameter ‘__log1p’
/usr/include/bits/mathcalls.h:135: error: storage class specified for parameter ‘logb’
/usr/include/bits/mathcalls.h:135: error: storage class specified for parameter ‘__logb’
/usr/include/bits/mathcalls.h:154: error: storage class specified for parameter ‘pow’
/usr/include/bits/mathcalls.h:154: error: storage class specified for parameter ‘__pow’
/usr/include/bits/mathcalls.h:157: error: storage class specified for parameter ‘sqrt’
/usr/include/bits/mathcalls.h:157: error: storage class specified for parameter ‘__sqrt’
/usr/include/bits/mathcalls.h:163: error: storage class specified for parameter ‘hypot’
/usr/include/bits/mathcalls.h:163: error: storage class specified for parameter ‘__hypot’
/usr/include/bits/mathcalls.h:170: error: storage class specified for parameter ‘cbrt’
/usr/include/bits/mathcalls.h:170: error: storage class specified for parameter ‘__cbrt’
/usr/include/bits/mathcalls.h:179: error: storage class specified for parameter ‘ceil’
/usr/include/bits/mathcalls.h:179: error: storage class specified for parameter ‘__ceil’
/usr/include/bits/mathcalls.h:182: error: storage class specified for parameter ‘fabs’
/usr/include/bits/mathcalls.h:182: error: storage class specified for parameter ‘__fabs’
/usr/include/bits/mathcalls.h:185: error: storage class specified for parameter ‘floor’
/usr/include/bits/mathcalls.h:185: error: storage class specified for parameter ‘__floor’
/usr/include/bits/mathcalls.h:188: error: storage class specified for parameter ‘fmod’
/usr/include/bits/mathcalls.h:188: error: storage class specified for parameter ‘__fmod’
/usr/include/bits/mathcalls.h:193: error: storage class specified for parameter ‘__isinf’
/usr/include/bits/mathcalls.h:196: error: storage class specified for parameter ‘__finite’
/usr/include/bits/mathcalls.h:202: error: storage class specified for parameter ‘isinf’
/usr/include/bits/mathcalls.h:205: error: storage class specified for parameter ‘finite’
/usr/include/bits/mathcalls.h:208: error: storage class specified for parameter ‘drem’
/usr/include/bits/mathcalls.h:208: error: storage class specified for parameter ‘__drem’
/usr/include/bits/mathcalls.h:212: error: storage class specified for parameter ‘significand’
/usr/include/bits/mathcalls.h:212: error: storage class specified for parameter ‘__significand’
/usr/include/bits/mathcalls.h:218: error: storage class specified for parameter ‘copysign’
/usr/include/bits/mathcalls.h:218: error: storage class specified for parameter ‘__copysign’
/usr/include/bits/mathcalls.h:231: error: storage class specified for parameter ‘__isnan’
/usr/include/bits/mathcalls.h:235: error: storage class specified for parameter ‘isnan’
/usr/include/bits/mathcalls.h:238: error: storage class specified for parameter ‘j0’
/usr/include/bits/mathcalls.h:238: error: storage class specified for parameter ‘__j0’
/usr/include/bits/mathcalls.h:239: error: storage class specified for parameter ‘j1’
/usr/include/bits/mathcalls.h:239: error: storage class specified for parameter ‘__j1’
/usr/include/bits/mathcalls.h:240: error: storage class specified for parameter ‘jn’
/usr/include/bits/mathcalls.h:240: error: storage class specified for parameter ‘__jn’
/usr/include/bits/mathcalls.h:241: error: storage class specified for parameter ‘y0’
/usr/include/bits/mathcalls.h:241: error: storage class specified for parameter ‘__y0’
/usr/include/bits/mathcalls.h:242: error: storage class specified for parameter ‘y1’
/usr/include/bits/mathcalls.h:242: error: storage class specified for parameter ‘__y1’
/usr/include/bits/mathcalls.h:243: error: storage class specified for parameter ‘yn’
/usr/include/bits/mathcalls.h:243: error: storage class specified for parameter ‘__yn’
/usr/include/bits/mathcalls.h:250: error: storage class specified for parameter ‘erf’
/usr/include/bits/mathcalls.h:250: error: storage class specified for parameter ‘__erf’
/usr/include/bits/mathcalls.h:251: error: storage class specified for parameter ‘erfc’
/usr/include/bits/mathcalls.h:251: error: storage class specified for parameter ‘__erfc’
/usr/include/bits/mathcalls.h:252: error: storage class specified for parameter ‘lgamma’
/usr/include/bits/mathcalls.h:252: error: storage class specified for parameter ‘__lgamma’
/usr/include/bits/mathcalls.h:265: error: storage class specified for parameter ‘gamma’
/usr/include/bits/mathcalls.h:265: error: storage class specified for parameter ‘__gamma’
/usr/include/bits/mathcalls.h:272: error: storage class specified for parameter ‘lgamma_r’
/usr/include/bits/mathcalls.h:272: error: storage class specified for parameter ‘__lgamma_r’
/usr/include/bits/mathcalls.h:280: error: storage class specified for parameter ‘rint’
/usr/include/bits/mathcalls.h:280: error: storage class specified for parameter ‘__rint’
/usr/include/bits/mathcalls.h:283: error: storage class specified for parameter ‘nextafter’
/usr/include/bits/mathcalls.h:283: error: storage class specified for parameter ‘__nextafter’
/usr/include/bits/mathcalls.h:289: error: storage class specified for parameter ‘remainder’
/usr/include/bits/mathcalls.h:289: error: storage class specified for parameter ‘__remainder’
/usr/include/bits/mathcalls.h:293: error: storage class specified for parameter ‘scalbn’
/usr/include/bits/mathcalls.h:293: error: storage class specified for parameter ‘__scalbn’
/usr/include/bits/mathcalls.h:297: error: storage class specified for parameter ‘ilogb’
/usr/include/bits/mathcalls.h:297: error: storage class specified for parameter ‘__ilogb’
/usr/include/bits/mathcalls.h:364: error: storage class specified for parameter ‘scalb’
/usr/include/bits/mathcalls.h:364: error: storage class specified for parameter ‘__scalb’
In file included from /usr/include/math.h:94,
                 from src/system.c:5897:
/usr/include/bits/mathcalls.h:55: error: storage class specified for parameter ‘acosf’
/usr/include/bits/mathcalls.h:55: error: storage class specified for parameter ‘__acosf’
/usr/include/bits/mathcalls.h:57: error: storage class specified for parameter ‘asinf’
/usr/include/bits/mathcalls.h:57: error: storage class specified for parameter ‘__asinf’
/usr/include/bits/mathcalls.h:59: error: storage class specified for parameter ‘atanf’
/usr/include/bits/mathcalls.h:59: error: storage class specified for parameter ‘__atanf’
/usr/include/bits/mathcalls.h:61: error: storage class specified for parameter ‘atan2f’
/usr/include/bits/mathcalls.h:61: error: storage class specified for parameter ‘__atan2f’
/usr/include/bits/mathcalls.h:64: error: storage class specified for parameter ‘cosf’
/usr/include/bits/mathcalls.h:64: error: storage class specified for parameter ‘__cosf’
/usr/include/bits/mathcalls.h:66: error: storage class specified for parameter ‘sinf’
/usr/include/bits/mathcalls.h:66: error: storage class specified for parameter ‘__sinf’
/usr/include/bits/mathcalls.h:68: error: storage class specified for parameter ‘tanf’
/usr/include/bits/mathcalls.h:68: error: storage class specified for parameter ‘__tanf’
/usr/include/bits/mathcalls.h:73: error: storage class specified for parameter ‘coshf’
/usr/include/bits/mathcalls.h:73: error: storage class specified for parameter ‘__coshf’
/usr/include/bits/mathcalls.h:75: error: storage class specified for parameter ‘sinhf’
/usr/include/bits/mathcalls.h:75: error: storage class specified for parameter ‘__sinhf’
/usr/include/bits/mathcalls.h:77: error: storage class specified for parameter ‘tanhf’
/usr/include/bits/mathcalls.h:77: error: storage class specified for parameter ‘__tanhf’
/usr/include/bits/mathcalls.h:89: error: storage class specified for parameter ‘acoshf’
/usr/include/bits/mathcalls.h:89: error: storage class specified for parameter ‘__acoshf’
/usr/include/bits/mathcalls.h:91: error: storage class specified for parameter ‘asinhf’
/usr/include/bits/mathcalls.h:91: error: storage class specified for parameter ‘__asinhf’
/usr/include/bits/mathcalls.h:93: error: storage class specified for parameter ‘atanhf’
/usr/include/bits/mathcalls.h:93: error: storage class specified for parameter ‘__atanhf’
/usr/include/bits/mathcalls.h:101: error: storage class specified for parameter ‘expf’
/usr/include/bits/mathcalls.h:101: error: storage class specified for parameter ‘__expf’
/usr/include/bits/mathcalls.h:104: error: storage class specified for parameter ‘frexpf’
/usr/include/bits/mathcalls.h:104: error: storage class specified for parameter ‘__frexpf’
/usr/include/bits/mathcalls.h:107: error: storage class specified for parameter ‘ldexpf’
/usr/include/bits/mathcalls.h:107: error: storage class specified for parameter ‘__ldexpf’
/usr/include/bits/mathcalls.h:110: error: storage class specified for parameter ‘logf’
/usr/include/bits/mathcalls.h:110: error: storage class specified for parameter ‘__logf’
/usr/include/bits/mathcalls.h:113: error: storage class specified for parameter ‘log10f’
/usr/include/bits/mathcalls.h:113: error: storage class specified for parameter ‘__log10f’
/usr/include/bits/mathcalls.h:116: error: storage class specified for parameter ‘modff’
/usr/include/bits/mathcalls.h:116: error: storage class specified for parameter ‘__modff’
/usr/include/bits/mathcalls.h:129: error: storage class specified for parameter ‘expm1f’
/usr/include/bits/mathcalls.h:129: error: storage class specified for parameter ‘__expm1f’
/usr/include/bits/mathcalls.h:132: error: storage class specified for parameter ‘log1pf’
/usr/include/bits/mathcalls.h:132: error: storage class specified for parameter ‘__log1pf’
/usr/include/bits/mathcalls.h:135: error: storage class specified for parameter ‘logbf’
/usr/include/bits/mathcalls.h:135: error: storage class specified for parameter ‘__logbf’
/usr/include/bits/mathcalls.h:154: error: storage class specified for parameter ‘powf’
/usr/include/bits/mathcalls.h:154: error: storage class specified for parameter ‘__powf’
/usr/include/bits/mathcalls.h:157: error: storage class specified for parameter ‘sqrtf’
/usr/include/bits/mathcalls.h:157: error: storage class specified for parameter ‘__sqrtf’
/usr/include/bits/mathcalls.h:163: error: storage class specified for parameter ‘hypotf’
/usr/include/bits/mathcalls.h:163: error: storage class specified for parameter ‘__hypotf’
/usr/include/bits/mathcalls.h:170: error: storage class specified for parameter ‘cbrtf’
/usr/include/bits/mathcalls.h:170: error: storage class specified for parameter ‘__cbrtf’
/usr/include/bits/mathcalls.h:179: error: storage class specified for parameter ‘ceilf’
/usr/include/bits/mathcalls.h:179: error: storage class specified for parameter ‘__ceilf’
/usr/include/bits/mathcalls.h:182: error: storage class specified for parameter ‘fabsf’
/usr/include/bits/mathcalls.h:182: error: storage class specified for parameter ‘__fabsf’
/usr/include/bits/mathcalls.h:185: error: storage class specified for parameter ‘floorf’
/usr/include/bits/mathcalls.h:185: error: storage class specified for parameter ‘__floorf’
/usr/include/bits/mathcalls.h:188: error: storage class specified for parameter ‘fmodf’
/usr/include/bits/mathcalls.h:188: error: storage class specified for parameter ‘__fmodf’
/usr/include/bits/mathcalls.h:193: error: storage class specified for parameter ‘__isinff’
/usr/include/bits/mathcalls.h:196: error: storage class specified for parameter ‘__finitef’
/usr/include/bits/mathcalls.h:202: error: storage class specified for parameter ‘isinff’
/usr/include/bits/mathcalls.h:205: error: storage class specified for parameter ‘finitef’
/usr/include/bits/mathcalls.h:208: error: storage class specified for parameter ‘dremf’
/usr/include/bits/mathcalls.h:208: error: storage class specified for parameter ‘__dremf’
/usr/include/bits/mathcalls.h:212: error: storage class specified for parameter ‘significandf’
/usr/include/bits/mathcalls.h:212: error: storage class specified for parameter ‘__significandf’
/usr/include/bits/mathcalls.h:218: error: storage class specified for parameter ‘copysignf’
/usr/include/bits/mathcalls.h:218: error: storage class specified for parameter ‘__copysignf’
/usr/include/bits/mathcalls.h:231: error: storage class specified for parameter ‘__isnanf’
/usr/include/bits/mathcalls.h:235: error: storage class specified for parameter ‘isnanf’
/usr/include/bits/mathcalls.h:238: error: storage class specified for parameter ‘j0f’
/usr/include/bits/mathcalls.h:238: error: storage class specified for parameter ‘__j0f’
/usr/include/bits/mathcalls.h:239: error: storage class specified for parameter ‘j1f’
/usr/include/bits/mathcalls.h:239: error: storage class specified for parameter ‘__j1f’
/usr/include/bits/mathcalls.h:240: error: storage class specified for parameter ‘jnf’
/usr/include/bits/mathcalls.h:240: error: storage class specified for parameter ‘__jnf’
/usr/include/bits/mathcalls.h:241: error: storage class specified for parameter ‘y0f’
/usr/include/bits/mathcalls.h:241: error: storage class specified for parameter ‘__y0f’
/usr/include/bits/mathcalls.h:242: error: storage class specified for parameter ‘y1f’
/usr/include/bits/mathcalls.h:242: error: storage class specified for parameter ‘__y1f’
/usr/include/bits/mathcalls.h:243: error: storage class specified for parameter ‘ynf’
/usr/include/bits/mathcalls.h:243: error: storage class specified for parameter ‘__ynf’
/usr/include/bits/mathcalls.h:250: error: storage class specified for parameter ‘erff’
/usr/include/bits/mathcalls.h:250: error: storage class specified for parameter ‘__erff’
/usr/include/bits/mathcalls.h:251: error: storage class specified for parameter ‘erfcf’
/usr/include/bits/mathcalls.h:251: error: storage class specified for parameter ‘__erfcf’
/usr/include/bits/mathcalls.h:252: error: storage class specified for parameter ‘lgammaf’
/usr/include/bits/mathcalls.h:252: error: storage class specified for parameter ‘__lgammaf’
/usr/include/bits/mathcalls.h:265: error: storage class specified for parameter ‘gammaf’
/usr/include/bits/mathcalls.h:265: error: storage class specified for parameter ‘__gammaf’
/usr/include/bits/mathcalls.h:272: error: storage class specified for parameter ‘lgammaf_r’
/usr/include/bits/mathcalls.h:272: error: storage class specified for parameter ‘__lgammaf_r’
/usr/include/bits/mathcalls.h:280: error: storage class specified for parameter ‘rintf’
/usr/include/bits/mathcalls.h:280: error: storage class specified for parameter ‘__rintf’
/usr/include/bits/mathcalls.h:283: error: storage class specified for parameter ‘nextafterf’
/usr/include/bits/mathcalls.h:283: error: storage class specified for parameter ‘__nextafterf’
/usr/include/bits/mathcalls.h:289: error: storage class specified for parameter ‘remainderf’
/usr/include/bits/mathcalls.h:289: error: storage class specified for parameter ‘__remainderf’
/usr/include/bits/mathcalls.h:293: error: storage class specified for parameter ‘scalbnf’
/usr/include/bits/mathcalls.h:293: error: storage class specified for parameter ‘__scalbnf’
/usr/include/bits/mathcalls.h:297: error: storage class specified for parameter ‘ilogbf’
/usr/include/bits/mathcalls.h:297: error: storage class specified for parameter ‘__ilogbf’
/usr/include/bits/mathcalls.h:364: error: storage class specified for parameter ‘scalbf’
/usr/include/bits/mathcalls.h:364: error: storage class specified for parameter ‘__scalbf’
In file included from /usr/include/math.h:141,
                 from src/system.c:5897:
/usr/include/bits/mathcalls.h:55: error: storage class specified for parameter ‘acosl’
/usr/include/bits/mathcalls.h:55: error: storage class specified for parameter ‘__acosl’
/usr/include/bits/mathcalls.h:57: error: storage class specified for parameter ‘asinl’
/usr/include/bits/mathcalls.h:57: error: storage class specified for parameter ‘__asinl’
/usr/include/bits/mathcalls.h:59: error: storage class specified for parameter ‘atanl’
/usr/include/bits/mathcalls.h:59: error: storage class specified for parameter ‘__atanl’
... 133 more lines ...
  336   02 Feb 2007 Exaos LeeBug FixProblem solved by Re-define _syscall0(...)
OK, I searched and found that my kernel doesn't support "_syscall0" any more. So I patched the system.c as the following (from line 954):

#if defined(OS_DARWIN)
// blank
#elif defined(OS_LINUX)

#include <sys/syscall.h>
#include <unistd.h>
#undef _syscall0
#define _syscall0(type, name) \
  type name(void) \
  {\
    return syscall(__NR_##name); \
  }

_syscall0(pid_t,gettid)
#endif


My kernel version:
exaos@memes midas>$ uname -a
Linux memes 2.6.17-10-generic #2 SMP Tue Dec 5 22:28:26 UTC 2006 i686 GNU/Linux

Maybe it's not the perfect way, but it works. Smile
  364   02 Apr 2007 Exaos LeeBug FixSIGABT of "mlogger" and possible fix
Version: svn 3658
Code: mlogger.c
Problem: After executation of "mlogger", a "SIGABT" appears.
Compiler: GCC 4.1.2, under Ubuntu Linux 7.04 AMD64
Possible fix:
Change the code in "mlogger.c" from
   /* append argument "-b" for batch mode without graphics */
   rargv[rargc] = (char *) malloc(3);
   rargv[rargc++] = "-b";

   TApplication theApp("mlogger", &rargc, rargv);

   /* free argument memory */
   free(rargv[0]);
   free(rargv[1]);
   free(rargv);
to
   /* append argument "-b" for batch mode without graphics */
   rargv[rargc] = (char *) malloc(3);
   rargv[rargc++] = "-b";

   TApplication theApp("mlogger", &rargc, rargv);

   /* free argument memory */
   free(rargv[0]);
   /*free(rargv[1]);*/
   free(rargv);

I think, it might be the problem of 'rargv[rargc++]="-b"'. You may try the following test program:
#include <stdio.h>
#include <malloc.h>

int main(int argc, char** argv)
{
        char* pp;
        pp = (char *)malloc(sizeof(char)*3);
        /* pp = "-b"; */
        strcpy(pp,"-b");
        printf("PP=%s\n",pp);
        free(pp);

        return 0;
}
If using "pp=\"-b\"", a SIGABRT appears.
  435   18 Feb 2008 Exaos LeeBug ReportGreat! But I failed to run it. :(
I encountered the error message as the following:
Traceback (most recent call last):
  File "runtest.py", line 42, in <module>
    import midas
  File "/opt/MIDAS.PSI/Resources/PyMIDAS/pymidas/midas/__init__.py", line 140, in
<module>
    cmidas = ctypes.cdll.LoadLibrary('libmidas.so')
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 431, in LoadLibrary
    
  File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 348, in __init__
    
OSError: /opt/MIDAS.PSI/Versions/Current/lib/libmidas.so: undefined symbol:
cam16i_rq

Compiling the MIDAS library using NEED_SHLIB=1 causes the same "undefined
reference" error. But it can be fixed by adding "-shared" to CFLAGS in the
Makefile. Though the libmidas.so can be successfully created, the above error is
still there. Can anybody help me?

Environment:
Platform: Ubuntu Linux 7.10 with gcc 4.1
MIDAS version: 2.0.0, svn-4106
Python version: 2.5.1
  451   02 Mar 2008 Exaos LeeSuggestionBash Script for handling an experiment code
I rearanged the files in "examples/experiment" as the attached "mtest_exp.zip". I re-write the start/stop script as the attached "daq.sh". The script "daq.sh" can be re-used for many experiments. The user only needs to provide an script "daq_env.sh" as the following containing the settings for the experiment environment.
#!/bin/sh

[ ! "$MIDASSYS" ] && MIDASSYS=/opt/MIDAS.PSI/Version/Current
[ ! "$HTTPPORT" ] && HTTPPORT=8080
[ ! "$SRVHOST" ]  && SRVHOST=localhost
LOGGER=${MIDASSYS}/bin/mlogger

EXPPATH=/home/das/online/test
CODEPATH=${EXPPATH}/code
LOGGER=${MIDASSYS}/bin/mlogger

PROG_FE=${CODEPATH}/frontend
PROG_ANA=${CODEPATH}/analyzer

if [ ! "$MIDAS_EXPTAB" ]; then
	MIDAS_DIR=${EXPPATH}
else
	MIDAS_EXPT_NAME="test"
fi


I hope this can be helpful. Smile There seem to be some problems such as:
1. When several experiments are defined, the $LOGGER may be not the one used for this exp.
2. The "pidof" may be not in some platforms, so this script is limited.

Hope anybody can help me to improve it for general purpose. All my best!
Attachment 1: daq.sh
#!/bin/sh

DAQ_SETENV=./daq_env.sh

[ -f "${DAQ_SETENV}" ] && source ${DAQ_SETENV}

### Start ....
start() 
{
    #### Running mserver
    pidmsrv=`pidof mserver`
    if [ ! "$pidmsrv" ]; then
	echo Starting mserver ...
	$MIDASSYS/bin/mserver -D -m
	pidmhttpd=`pidof mhttpd`
	[ "$pidmhttpd" ] && kill -9 $pidmhttpd
	echo Starting mhttpd ...
	$MIDASSYS/bin/mhttpd -h localhost -D -p $HTTPPORT
    fi

    #### Change work directory
    OLD_DIR=`pwd`
    cd ${EXPPATH}
    
    #### Running FE and Analyzer ...

    # Options for multi experiments running ...
    [ "$MIDAS_EXPTAB" ] && OPTIONS="-e $MIDAS_EXPT_NAME"

    $MIDASSYS/bin/odbedit ${OPTIONS} -c clean

    sleep 2

    echo Starting frontend session: ${PROG_FE} ...
    ${PROG_FE}  ${OPTIONS} -D

    echo Starting analyzer session: ${PROG_ANA} ...
    ${PROG_ANA} ${OPTIONS} -D

    sleep 1

    echo Starting logger utility: mlogger ...
    ${LOGGER} ${OPTIONS} -D

    cat <<EOF
Please point your web browser to http://localhost:$HTTPPORT
Or run: firefox http://localhost:$HTTPPORT
To look at live histograms, run: roody -Hlocalhost

EOF

    #### Resume old directory
    cd ${OLD_DIR}
}

### Stop ....
stop() 
{
    #### Kill Running sessions
    pidlog=`pidof $(basename ${LOGGER})`
    pidfe=` pidof $(basename ${PROG_FE})`
    pidana=`pidof $(basename ${PROG_ANA})`
    [ "$pidlog" ] && kill $pidlog
    [ "$pidfe"  ] && kill $pidfe
    [ "$pidana" ] && kill $pidana
}

### Status ....
status()
{
    echo "MIDAS Server (mserver): "
    pid=`pidof mserver`
    echo_status $pid

    echo "MIDAS HTTPD Server (mhttpd): "
    pid=`pidof mhttpd`
    echo_status $pid

    echo "Logger (${LOGGER}): "
    pid=`pidof $(basename ${LOGGER})`
    echo_status $pid

    echo "Frontend Code ($PROG_FE): "
    pid=`pidof $(basename ${PROG_FE})`
    echo_status $pid

    echo "Analyzer Code ($PROG_ANA): "
    pid=`pidof $(basename ${PROG_ANA})`
    echo_status $pid
}

echo_status()
{
    if [ "$1" ]; then
	echo -e "\t Running as $1."
    else
	echo -e "\t Not Running!"
    fi
}

### Usage ....
usage()
{
    echo "Usage: $0 [<start>|<stop>|<restart>|<status>]"
}

###################### Main Procedure ###########################
case "${1:-''}" in 
    "start")
	start
	;;
    "stop")
	stop
	;;
    "restart")
	stop
	start
	;;
    "status")
	status
	;;
    *)
	usage
	;;
esac

#########################  The END  #############################
Attachment 2: mtest_exp.zip
  455   09 Mar 2008 Exaos LeeSuggestionNew Makefile for building MIDAS
I rewrote the Makefile for MIDAS in order to make it tidy. I tested it on my box
and it works here.
1. The full file is seperated to several parts
  a. initialized setup
  b. environment setup
  c. specify OS-specific flags
  d. processing environment for building flags
  e. targets
2. The file is less than 400 lines now. The original one is more than 500 lines.
3. The modified one is easy for debuging.

I tried to learn "autoconf" and "automake" in order to make building MIDAS more
compatible for various platforms. But I havn't enough time now. Hope somebody
can help it. The attached file is original named "Makefile.in" for using "autoconf".

:-)
Attachment 1: Makefile-by-EL
# initialized flags

#CC =
#FC = 
#LD =
CFLAGS   = -g -O3 -Wall -Wuninitialized -DINCLUDE_FTPLIB

###########################################################################
## Environments setup

## Prefix
ifndef PREFIX
PREFIX = /usr/local
endif

# User defined flags for compiler
USERFLAGS     =

# Do you need to compile the shared library? If so, set "1" here.
NEED_SHLIB    =

# If RPATH needed ...
NEED_RPATH    =

# If static ROOT libaries needed ...
NEED_LIBROOTA =

# If strlcpy.o needed ...
NEED_STRLCPY  = 1

# If zlib needed ...
NEED_ZLIB     =

# MIDAS max event size
MIDAS_MAX_EVENT_SIZE =

# OS specific programs included
SPECIFIC_OS_PRG      =

# ..? Why it is needed?
MIDAS_PREF_FLAGS     =

## installer

INSTALL  = $(shell which install)
ifndef INSTALL
INSTALL  = ./install.sh
else
INS_OPTS = -v -D
endif

# MXML dir
ifndef MXML_DIR
MXML_DIR = ../mxml
endif

# MySQL
MYSQL_CONFIG := $(shell which mysql_config 2> /dev/null)
ifdef MYSQL_CONFIG
MYSQLINCDIR := $(shell mysql_config --cflags | sed -e 's,^.*-I\([^ ]*\).*$$,\1,' -e s/\'//g)
NEED_MYSQL  := $(shell if test -e $(MYSQLINCDIR)/mysql.h ; then echo 1; fi) 
endif

###########################################################################
## Check OS Type for OS-specified flags

OSTYPE = $(shell uname | tr '[A-Z]' '[a-z]')

ifeq ($(OSTYPE), linux)
# > 2GB file support
CFLAGS  += -D_LARGEFILE64_SOURCE
CFLAGS  += -DOS_LINUX -fPIC -Wno-unused-function
LDFLAGS += -lutil -lpthread
NEED_ZLIB        =1
SPECIFIC_OS_PRG += mlxspeaker dio
endif

ifeq ($(OSTYPE), osf1)
CFLAGS  += -DOS_OSF1
FFLAGS  += -nofor_main -D 40000000 -T 20000000
LDFLAGS += -lc -lbsd
endif

ifeq ($(OSTYPE), ultrix)
CFLAGS  += -DOS_ULTRIX -DNO_PTY
endif

ifeq ($(OSTYPE), freebsd)
CFLAGS  += -DOS_FREEBSD
LDFLAGS += -lbsd -lcompat
endif

ifeq ($(OSTYPE), darwin)
CFLAGS  += -DOS_LINUX -DOS_DARWIN -DHAVE_STRLCPY -fPIC -Wno-unused-function
LDFLAGS += -lpthread
NEED_RANLIB      = 1
SPECIFIC_OS_PRG += mlxspeaker
endif

ifeq ($(OSTYPE), cygwin_nt-5.1)
OSTYPE = cygwin
endif

ifeq ($(OSTYPE), cygwin)
CFLAGS  += -DOS_LINUX -DOS_CYGWIN -Wno-unused-function
LDFLAGS += -lutil -lpthread
endif

ifeq ($(OSTYPE), solaris)
CFLAGS  += -DOS_SOLARIS
LDFLAGS += -lsocket -lnsl
endif

###########################################################################
## Processing environment for building flags

CFLAGS += $(MIDAS_PREF_FLAGS) $(USERFLAGS)

ifdef MIDAS_MAX_EVENT_SIZE
CFLAGS += -DMAX_EVENT_SIZE=$(MIDAS_MAX_EVENT_SIZE)
endif # MIDAS_MAX_EVENT_SIZE

ifdef NEED_MYSQL
CFLAGS  += -DHAVE_MYSQL $(shell $(MYSQL_CONFIG) --include)
LDFLAGS += $(shell $(MYSQL_CONFIG) --libs)
NEED_ZLIB =1
endif # NEED_MYSQL

ifdef ROOTSYS
ROOTLIBS    := $(shell $(ROOTSYS)/bin/root-config --libs)
ROOTCFLAGS  := $(shell $(ROOTSYS)/bin/root-config --cflags)

ifdef NEED_RPATH
ROOTLIBS   += -Wl,-rpath,$(ROOTSYS)/lib
endif

ifdef NEED_LIBROOTA
ROOTLIBS    := $(ROOTSYS)/lib/libRoot.a -lssl -ldl -lcrypt
endif

CFLAGS += $(ROOTCFLAGS)
endif # ROOTSYS

ifdef NEED_ZLIB
CFLAGS     += -DHAVE_ZLIB
LIBS       += -lz
endif # ZLIB

ifdef NEED_SHLIB
CFLAGS  += -shared -fPIC
endif # SHLIB

###########################################################################
## Processing building targets

## Directories needed

INC_DIR = include
SRC_DIR = src
UTL_DIR = utils
DRV_DIR = drivers
EXM_DIR = examples

## Driectories which will be created

OS_DIR  = $(OSTYPE)
LIB_DIR = $(OS_DIR)/lib
BIN_DIR = $(OS_DIR)/bin
DIRS    = $(OS_DIR)  $(LIB_DIR)  $(BIN_DIR)

CFLAGS += -I$(INC_DIR) -I$(DRV_DIR) -I$(MXML_DIR) -L$(LIB_DIR)

## Directories for install

INSTDIR_BIN = $(PREFIX)/bin
INSTDIR_INC = $(PREFIX)/include
INSTDIR_LIB = $(PREFIX)/lib
INSTDIR_DRV = $(PREFIX)/driver

## Utilities

PROGS = mserver  mhttpd  mlogger  odbedit  mtape   mhist    \
	mstat    mcnaf   mdump    mhdump    mchart  odbhist  \
	melog    webpaw  lazylogger   stripchart.tcl  \
	$(SPECIFIC_OS_PRG)

UTILS = $(shell for i in $(PROGS); do echo $(BIN_DIR)/$$i ; done)

## Analyzer objects

ANALYZER  = $(LIB_DIR)/mana.o
ifdef CERNLIB
ANALYZER += $(LIB_DIR)/hmana.o
endif
ifdef ROOTSYS
ANALYZER += $(LIB_DIR)/rmana.o
endif

## Objects for building $(LIBMIDAS_A) and $(LIBMIDAS_SO)

OBJS_LIB_NEED = midas.o  system.o  mrpc.o  odb.o  ybos.o  ftplib.o  history.o  alarm.o  elog.o

ifndef NEED_SHLIB
OBJS_LIB_NEED += cnaf_callback.o
endif

OBJS_LIB = $(shell for i in $(OBJS_LIB_NEED) ; do echo $(LIB_DIR)/$$i ; done)

## MXML OBJS

MXML_OBJS_NEED = mxml.o
ifdef NEED_STRLCPY
MXML_OBJS_NEED += strlcpy.o
endif

MXML_OBJS = $(shell for i in $(MXML_OBJS_NEED) ; do echo $(LIB_DIR)/$$i ; done)

## Objects for install

OBJS_INS_NEED = mfe.o fal.o
OBJS_INS = $(shell for i in $(OBJS_INS_NEED) ; do echo $(LIB_DIR)/$$i ; done)

## library

LIBMIDAS_A  = $(LIB_DIR)/libmidas.a
ifdef NEED_SHLIB
LIBMIDAS_SO  = $(LIB_DIR)/libmidas.so
LDFLAGS     += -shared -L$(LIB_DIR) -lmidas
endif

## Examples

EXAMPLES_NEED = consume produce rpc_test msgdump minife minirc odb_test
EXAMPLES = $(shell for i in $(EXAMPLES_NEED); do echo examples/$$i ; done)

## Includes

INCLUDES = $(wildcard $(INC_DIR)/*.h)

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

CXXFLAGS  = $(CFLAGS)
ifdef ROOTSYS
CXXFLAGS += -DHAVE_ROOT
endif

all: check-mxml mkdirs $(LIBMIDAS_A) $(LIBMIDAS_SO) $(ANALYZER) $(OBJS_INS) utilities

.PHONY: clean

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

## Library objects

$(LIB_DIR)/%.o: $(SRC_DIR)/%.c $(INCLUDES)
	$(CC) $(CFLAGS) -c -o $@ $<

## MXML_OBJS

$(LIB_DIR)/mxml.o: $(MXML_DIR)/mxml.c
	$(CC) $(CFLAGS) -c -o $@ $<

$(LIB_DIR)/strlcpy.o: $(MXML_DIR)/strlcpy.c
	$(CC) $(CFLAGS) -c -o $@ $<

## Frontend and backend framework

$(LIB_DIR)/fal.o: $(SRC_DIR)/fal.c $(INCLUDES)
	$(CXX) -Dextname -DMANA_LITE -c -o $@ $< $(CFLAGS)

$(LIB_DIR)/hmana.o: $(SRC_DIR)/mana.c $(INCLUDES)
	$(CC) -Dextname -DHAVE_HBOOK $(CFLAGS) -c -o $@ $<

$(LIB_DIR)/rmana.o: $(SRC_DIR)/mana.c $(INCLUDES)
	$(CXX) -DUSE_ROOT $(CXXFLAGS) -c -o $@ $<

## Utilities

$(BIN_DIR)/%: $(UTL_DIR)/%.c $(INCLUDES)
	$(CC) $(CFLAGS) -o $@ $< $(LIBMIDAS_A) $(LDFLAGS)

$(BIN_DIR)/mlogger: $(SRC_DIR)/mlogger.c $(LIBMIDAS_A)
	$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(ROOTLIBS)
$(BIN_DIR)/mserver: $(SRC_DIR)/mserver.c $(INCLUDES)
$(BIN_DIR)/mhttpd:  $(SRC_DIR)/mhttpd.c  $(SRC_DIR)/mgd.c
$(BIN_DIR)/odbedit: $(SRC_DIR)/odbedit.c $(SRC_DIR)/cmdedit.c
$(BIN_DIR)/mcnaf:   $(UTL_DIR)/mcnaf.c   $(DRV_DIR)/camac/camacrpc.c
$(BIN_DIR)/mhdump:  $(UTL_DIR)/mhdump.cxx
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) $(ROOTLIBS)
$(BIN_DIR)/lazylogger: $(SRC_DIR)/lazylogger.c
$(BIN_DIR)/stripchart.tcl: $(UTL_DIR)/stripchart.tcl
	@cp -f $< $(BIN_DIR)/$(shell basename $@)

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

mkdirs:
	@for i in $(DIRS) ; do \
		echo "Making directory $$i ..." ; \
		mkdir -p $$i ; \
	done
... 108 more lines ...
  464   10 Mar 2008 Exaos LeeSuggestionNew Makefile for building MIDAS
> Most experience with autoconf/automake is all negative. The promise was "never debug your Makefile ever 
> again!", delivered was "debug the configure script instead!". In practice, with autoconf/automake, you try to run 
> configure, kludge it until it stops crashing, then tweak the incomprehensible Makefiles it produces until the code 
> compiles.
> 
> K.O.

I admit that the new one is fit to my flavor. For a common user, I think, a simple procedure of configure/make/install
is better than changing the Makefile manually because many users are lack of knowledges about Makefile. That's why 
I want to learn autotools. The configure script is generated automatically by "autoconf", so you needn't to debug it. 
For the developer, you need to debug the configure.ac/in files for generating the configure script. For a common user, 
he/she only needs to run it. In fact, some more complex projects like ROOT use AUTOTOOLS and they don't include 
the original files which are needed for generating the "configure" script.  I prefer the MIDAS project includes such a 
script to make the compiling simpler and easier instead of changing the Makefile manually. 
  465   10 Mar 2008 Exaos LeeSuggestionNew Makefile for building MIDAS
> The Makefile is missing -lzip:

Sorry, spelling error.
The "LIBS +=" should be replaced by "LDFLAGS +="
  466   10 Mar 2008 Exaos LeeSuggestion"Makefile-by-EL" updated
> Not that the current Makefile is too pretty (I have seen worse), but it 
works and it is fairly compact for a project of 
> this complexity, it handles a large number of operating systems and build 
options very efficiently.
> 
> I think you found that out with your rewriting exercise - your version of 
the Makefile contains all the same code, 
> just rearranged to suite your taste, with existing bugs preserved and new 
bugs added.

I derived the new Makefile from the original one so that feathers and bugs are 
also included. 
I havn't experiences on platforms other than Linux and MacOS, so I cannot 
recognize bugs on 
other platforms if they exists in the original one. And if there are bugs, 
hope users can figure
them out.

>
> As they say, the devil is in the details. I notice some subtle changes in 
your Makefile that make me go "what?":
> 
> 1) the command for building the midas shared library used to be "ld -
shared", in your version, "-shared" is gone. 
> But check with the GCC manual, today's recommended command is probably "gcc -
shared".

Fixed.

> 2) mhdump is now linked with ROOT, but I wrote it recently enough to 
remember that it does not use ROOT

The building dependence on ROOT of mhdump may be eliminated by changing the 
specific target.

> 3) hand-crafted dependancies have been replaced with generic "almost 
every .o depends on every .h", which is 
> incorrect. The "almost every .o" part bothers me.

Fixed now.

> 4) "make clean" runs "rm -rf" - plain scary.

Fixed.

> 5) "$(shell ...)" is overused

Replaced with GNU make internal methods.


> I think by the end all these little details are sorted out and all the 
quirks are put back in, your Makefile will look no 
> better than the current Makefile.

I realized it now. But anyway, it looks tidy to me now. I still hope to use 
AUTOTOOLS with MIDAS.
 
> > 2. The file is less than 400 lines now. The original one is more than 500 
lines.

The new one is about 430 lines. Hmmm, it reaches the original one which is 
more than 600 lines.

> 
> It looks like your savings came from removing comments, removing hand-
crafted dependancy lists and replacing 
> fairly verbose "make install" targets (which we do not use anyway) with your 
own much simpler scripts.
> 
> All the juicy bits needed to actually build all the code appear to take 
about as much space as before.
> 
> Also the original mistake of recompiling programs when they only need 
relinking was not fixed. (For example, 
> when libmidas is updated, to update mhttpd, the current Makefile needlessly 
recompiles mhttpd.c. Better use 
> would be to compile mhttpd.c into mhttpd.o, then only a relink is needed).

Fixed.

> 
> Most experience with autoconf/automake is all negative. The promise 
was "never debug your Makefile ever 
> again!", delivered was "debug the configure script instead!". In practice, 
with autoconf/automake, you try to run 
> configure, kludge it until it stops crashing, then tweak the 
incomprehensible Makefiles it produces until the code 
> compiles.
> 
> K.O.

====================================================
Maybe BUGS or FEATURES in this new one:
1. The shared libmidas.so and the static libmidas.a are built sperately. 
The "libmidas.a" is 
always built whether "NEED_SHLIB" is set or not. And all executables are built 
staticly default. 
I commented this in the Makefile-by-EL. Hence, if you want to use libmidas.so 
with PyMIDAS and
do not want to encounter "Segmentation fault" while executing the utilies 
linked dynamicly, you
may try this one.
2. I found that "minife" is failed to be built, so I remove it from the 
example list.
3. Some bugs while building on MacOS Tiger 10.4.11 PPC are commented out in 
the Makefile. These
bugs are still exists in the original one.
4. Using "VPATH" instead of adding pathnames.
5. Using "UTILS_SUID" to handle utilities which need SUID mode. And 
the "UTILS_SUID_NEED" may be
defined in the OS-specific field, so you need not to use OS-specific commands 
in the "install"
target.
6. Using "tr" with "uname" in order to delete some extra "ifeq 
($(OSTYPE),...)".
7. Other things, please see the file.

Anyway, easier building is my purpose. :-)
Attachment 1: Makefile-by-EL
#-include MIDAS-env.mk --- split the environment setup in a seperate file?

# initialized flags

#CC = icc
#FC = ifort
#LD = ld
CFLAGS   = -g -O3 -Wall -Wuninitialized -DINCLUDE_FTPLIB

###########################################################################
## Environments setup for building MIDAS/PSI

## Prefix
ifndef PREFIX
PREFIX = /usr/local
endif

# User defined flags for compiler
USERFLAGS     =

# Do you need to compile the shared library? If so, set "1" here.
NEED_SHLIB    =

# If RPATH needed ...
NEED_RPATH    =

# If static ROOT libaries needed ...
NEED_LIBROOTA =

# If strlcpy.o needed ...
NEED_STRLCPY  = 1

# If zlib needed ...
NEED_ZLIB     = 1

# MIDAS max event size
MIDAS_MAX_EVENT_SIZE =

# OS specific programs included
SPECIFIC_OS_PRG      =

# ..? Why it is needed?
MIDAS_PREF_FLAGS     =

# Build examples or not? If so, set "1" here ...
EXAMPLES_NEED = 1

## installer
INSTALL  = $(shell which install)

# **** CAUTION ****
# **** On MacOS Tiger, "/usr/bin/install" doesn't accept "-D" option!
# **** NEED to be fixed ...
ifndef INSTALL
INSTALL  = ./install.sh
else
INS_OPTS = -v -D
endif

# MXML dir
ifndef MXML_DIR
MXML_DIR = ../mxml
endif

# MySQL
# **** CAUTION ****
# **** On MacOS Tiger (10.4.11), the "MYSQL_CONFIG" will be always defined because
# **** "which" will always return something whether it finds the exec or not!
# **** NEED to be fixed!
MYSQL_CONFIG := $(shell which mysql_config 2> /dev/null)

ifdef MYSQL_CONFIG
MYSQLINCDIR := $(shell mysql_config --cflags | sed -e 's,^.*-I\([^ ]*\).*$$,\1,' -e s/\'//g)
NEED_MYSQL  := $(shell if test -e $(MYSQLINCDIR)/mysql.h ; then echo 1; fi)
endif

###########################################################################
## Check OS Type for OS-specified flags

# *** CAUTION *** Does "tr" exist on all POSIX platform?
OSTYPE = $(shell uname | tr '[A-Z]' '[a-z]')

ifeq ($(OSTYPE), linux)
# > 2GB file support
CFLAGS  += -D_LARGEFILE64_SOURCE
CFLAGS  += -DOS_LINUX -fPIC -Wno-unused-function
LDFLAGS += -lutil -lpthread
NEED_ZLIB        = 1
SPECIFIC_OS_PRG += mlxspeaker dio
endif

ifeq ($(OSTYPE), osf1)
CFLAGS  += -DOS_OSF1
FFLAGS  += -nofor_main -D 40000000 -T 20000000
LDFLAGS += -lc -lbsd
endif

ifeq ($(OSTYPE), ultrix)
CFLAGS  += -DOS_ULTRIX -DNO_PTY
endif

ifeq ($(OSTYPE), freebsd)
CFLAGS  += -DOS_FREEBSD
LDFLAGS += -lbsd -lcompat
endif

ifeq ($(OSTYPE), darwin)
CFLAGS  += -DOS_LINUX -DOS_DARWIN -DHAVE_STRLCPY -fPIC -Wno-unused-function
LDFLAGS += -lpthread
NEED_RANLIB      = 1
SPECIFIC_OS_PRG += mlxspeaker
endif

ifeq ($(OSTYPE), cygwin_nt-5.1)
OSTYPE = cygwin
endif

ifeq ($(OSTYPE), cygwin)
CFLAGS  += -DOS_LINUX -DOS_CYGWIN -Wno-unused-function
LDFLAGS += -lutil -lpthread
endif

ifeq ($(OSTYPE), solaris)
CFLAGS  += -DOS_SOLARIS
LDFLAGS += -lsocket -lnsl
endif

###########################################################################
## Processing environment for building flags

CFLAGS += $(MIDAS_PREF_FLAGS) $(USERFLAGS)

ifdef MIDAS_MAX_EVENT_SIZE
CFLAGS   += -DMAX_EVENT_SIZE=$(MIDAS_MAX_EVENT_SIZE)
endif # MIDAS_MAX_EVENT_SIZE

ifdef NEED_MYSQL
CFLAGS     += -DHAVE_MYSQL $(shell $(MYSQL_CONFIG) --include)
LDFLAGS    += $(shell $(MYSQL_CONFIG) --libs)
NEED_ZLIB   = 1
endif # NEED_MYSQL

ifdef ROOTSYS
ROOTLIBS   := $(shell $(ROOTSYS)/bin/root-config --libs)
ROOTCFLAGS := $(shell $(ROOTSYS)/bin/root-config --cflags)

ifdef NEED_RPATH
ROOTLIBS   += -Wl,-rpath,$(ROOTSYS)/lib
endif

ifdef NEED_LIBROOTA
ROOTLIBS   := $(ROOTSYS)/lib/libRoot.a -lssl -ldl -lcrypt
endif

CFLAGS     += $(ROOTCFLAGS)
endif # ROOTSYS

ifdef NEED_ZLIB
CFLAGS     += -DHAVE_ZLIB
LDFLAGS    += -lz
endif # ZLIB

###########################################################################
## Processing building targets

## Directories needed
INC_DIR = include
SRC_DIR = src
UTL_DIR = utils
DRV_DIR = drivers
EXM_DIR = examples

## Driectories which will be created
OS_DIR  = $(OSTYPE)
LIB_DIR = $(OS_DIR)/lib
BIN_DIR = $(OS_DIR)/bin
DIRS    = $(OS_DIR) $(LIB_DIR) $(BIN_DIR)

CFLAGS += -I$(INC_DIR) -I$(DRV_DIR) -I$(MXML_DIR)

## Directories for install
INSTDIR_BIN = $(PREFIX)/bin
INSTDIR_INC = $(PREFIX)/include
INSTDIR_LIB = $(PREFIX)/lib
INSTDIR_DRV = $(PREFIX)/driver

## Utilities
UTILS = mserver mhttpd mlogger odbedit mtape  mhist    \
	mstat   mcnaf  mdump   mhdump  mchart odbhist  \
	melog   webpaw lazylogger   stripchart.tcl  \
	$(SPECIFIC_OS_PRG)

# Utilities need to change SUID mode
UTILS_SUID_NEED = dio mhttpd webpaw
UTILS_SUID = $(UTILS_SUID_NEED:%=$(BIN_DIR)/%)

## Analyzer objects
ANALYZER  = $(LIB_DIR)/mana.o

ifdef CERNLIB
ANALYZER += $(LIB_DIR)/hmana.o
endif
ifdef ROOTSYS
ANALYZER += $(LIB_DIR)/rmana.o
endif

## Objects for building $(LIBMIDAS_A) and $(LIBMIDAS_SO)
OBJS4LIB_ALL = midas.o system.o mrpc.o odb.o ybos.o ftplib.o history.o alarm.o elog.o
OBJS4LIB_A   = $(OBJS4LIB_ALL:%=$(LIB_DIR)/%) $(LIB_DIR)/cnaf_callback.o
OBJS4LIB_SO  = $(OBJS4LIB_ALL:%=$(LIB_DIR)/%)

## MXML OBJS
MXML_OBJS_NEED  = mxml.o
ifdef NEED_STRLCPY
MXML_OBJS_NEED += strlcpy.o
endif

MXML_OBJS = $(MXML_OBJS_NEED:%=$(LIB_DIR)/%)

## Objects for install
OBJS_INS_NEED = mfe.o fal.o
OBJS_INS = $(OBJS_INS_NEED:%=$(LIB_DIR)/%)

## library
LIBMIDAS_A  = $(LIB_DIR)/libmidas.a

ifdef NEED_SHLIB
LIBMIDAS_SO = $(LIB_DIR)/libmidas.so

CFLAGS     += -shared -fPIC
LDFLAGS    += -shared
# if need to link utilities dynamically with libmidas.so, add this flag...
LDFLAGS_SH += -shared -L$(LIB_DIR) -lmidas
endif # NEED_SHLIB

## Examples
EXAMPLES = consume produce rpc_test msgdump minirc odb_test #minife - failed building!

## All executables
EXECS  = $(UTILS:%=$(BIN_DIR)/%)
ifdef EXAMPLES_NEED
EXECS += $(EXAMPLES:%/$(BIN_DIR)/%)
endif

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

CXXFLAGS  = $(CFLAGS)

ifdef ROOTSYS
CXXFLAGS += -DHAVE_ROOT
endif

all: check-mxml $(DIRS) $(LIBMIDAS_A) $(LIBMIDAS_SO) \
     $(ANALYZER) $(OBJS_INS) $(EXECS)

.PHONY: clean

examples: $(LIBMIDAS_A) $(EXAMPLES:%=$(BIN_DIR)/%)

## Static
static:
	@rm -f $(EXECS)
	@$(MAKE) USERFLAGS=-static

## Install
install: install-utils install-includes install-libs \
	 install-drivers install-src install-examples
	@echo "..."
	@echo "... Happy working with MIDAS! "
	@echo "..."

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

$(DIRS):
	@echo "Making directory $@ ..."
	@mkdir -p $@

## Libraries
$(LIBMIDAS_A): $(OBJS4LIB_A) $(MXML_OBJS)
	@rm -f $@
	@echo "Creating $@ ..."
	@ar -crv $@ $^
ifdef NEED_RANLIB
	@ranlib $@
endif

$(LIBMIDAS_SO): $(OBJS4LIB_SO) $(MXML_OBJS)
	@rm -f $@
	@echo "Creating $@ ..."
	@$(CC) $(LDFLAGS) -o $@ $^

## MXML-check
check-mxml:
ifdef NEED_STRLCPY
	@if test ! -e $(MXML_DIR)/strlcpy.h ; then \
		echo "Please download mxml from: " ; \
		echo "http://midas.psi.ch/htmldoc/quickstart.html" ;\
		exit 1; \
	fi
... 135 more lines ...
ELOG V3.1.4-2e1708b5