source: JEM-EUSO/esaf_cc_at_lal/packages/tools/CreateNewLib.pl @ 114

Last change on this file since 114 was 114, checked in by moretto, 11 years ago

actual version of ESAF at CCin2p3

File size: 3.2 KB
Line 
1#!/usr/bin/perl
2# $Id: CreateNewLib.pl 1108 2004-09-28 08:17:29Z pallas $
3# simple tool to create an empty library structure
4# A. Thea.
5#
6
7use Getopt::Std;
8getopt('nus');
9
10use POSIX qw(strftime);
11$now_string = strftime "%b, %e %Y", gmtime;
12
13
14$shared = $opt_s;
15$libname = $opt_n;
16
17$libname or die "CreateLibClass: no name defined\n\t usage: CreateNewLib.pl -n name [-s standalone] [-u username]";
18
19$uid = $<;
20$user = (getpwuid($uid))[6];
21$user=~s/,.*$//;
22
23if ($opt_u) {
24  $user = $opt_u;
25}
26
27$aa = $classname;
28$aa=~y/[a-z]/[A-Z]/;
29
30
31print "creating $libname directory\n";
32mkdir($libname,0755);
33chdir($libname);
34
35print "creating include directory\n";
36mkdir("include",0755);
37
38print "creating src directory\n";
39mkdir("src",0755);
40
41print "creating GNUmakefile\n";
42open(MK,">GNUmakefile");
43
44if (!$shared) {
45print MK <<pippo;
46# GNUmakefile for $libname
47# \$Id\$
48# Author: $user $now_string
49
50
51#############################################################################
52# ESAF: Euso Simulation and Analysis Framework                              #
53#                                                                           #
54#  Id: $libname                                                             #
55#  Package: <packagename>                                                   #
56#  Coordinator: <coordinator>                                               #
57#                                                                           #
58#############################################################################
59
60PACKAGENAME := $libname
61
62ifndef ESAFINSTALL
63ESAFINSTALL = ../../../..#FIXME: ESAFINSTALL relative path
64endif
65
66ESAFPACKAGES = \$(ESAFINSTALL)/packages
67
68# Config parameters
69include \$(ESAFINSTALL)/packages/config.gmk
70
71# Include paths needed for rootcint dictionary generation
72INCLUDES += -I \$(ESAFPACKAGES)/common/base/include
73INCLUDES += -DUSE_VISUALIZATION
74
75# headers and settings needed for the local library compilation
76CXXFLAGS += \$(INCLUDES)
77
78include \$(ESAFINSTALL)/packages/makeso.gmk
79
80pippo
81} else {
82
83print MK <<pippo;
84# GNUmakefile for $libname
85# \$Id\$
86# $user created $now_string
87#
88
89name := $libname
90nameso := $shared
91
92LIBTARGET := lib\$(nameso).so
93
94ifndef ESAFINSTALL
95ESAFINSTALL = ../../../..#FIXME: ESAFINSTALL relative path
96endif
97
98ESAFPACKAGES = \$(ESAFINSTALL)/packages
99
100include \$(ESAFINSTALL)/packages/config.gmk
101
102CXXFLAGS += -I \$(ESAFPACKAGES)/common/base/include
103CXXFLAGS += -DUSE_VISUALIZATION
104
105linkdef := \$(nameso)LinkDef#FIXME: this is default Dict name
106dict := \$(nameso)Dict#FIXME: this is default Dict name
107libclasses :=#FIXME: Insert here the name of the files of the shared lib.
108
109dicts := \$(patsubst %,%.cc,\$(dict))
110dicth := \$(patsubst %,%.h,\$(dict))
111libheaders := \$(patsubst %,include/%.hh,\$(libclasses) \$(linkdef))
112libsources := \$(patsubst %,src/%.cc,\$(libclasses)) \$(dicts)
113
114include \$(ESAFINSTALL)/packages/common.gmk
115\$(LIBDIR)/\$(LIBTARGET): \$(LIBDIR)/lib\$(name).a
116        \@echo Building \$(nameso) dictionary...
117        \@rootcint -f \$(dicts) -c \$(libheaders)
118        \@echo Building \$(LIBTARGET)...
119        \$(CXX) --shared \$(CXXFLAGS) \$(dicts) -L\$(LIBDIR) -l\$(name) -o \$(LIBDIR)/\$(LIBTARGET)
120        \@echo Cleaning temporary files...
121        \@rm -r \$(dicts) \$(dicth)
122
123
124rootlib: \$(LIBDIR)/\$(LIBTARGET)
125
126pippo
127}
Note: See TracBrowser for help on using the repository browser.