File: default.aap

package info (click to toggle)
aap 1.072-1.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 4,976 kB
  • ctags: 2,160
  • sloc: python: 15,113; makefile: 62; sh: 13
file content (695 lines) | stat: -rw-r--r-- 21,553 bytes parent folder | download | duplicates (2)
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
# Part of the A-A-P recipe executive: Default variables, actions, etc.

# Copyright (c) 2002-2003 stichting NLnet Labs
# Permission to copy and use this file is specified in the file COPYING.
# If this file is missing you can find it here: http://www.a-a-p.org/COPYING

#
# This recipe is read to set all kinds of defaults.
#
# Note: Don't read this as an example for a recipe, it contains all the
# complicated stuff that you (hopefully) will not need to use in a normal
# recipe.
#

# System directories to look for modules and tools.
# This may be changed when installing Aap.
@if os.path.isdir("/usr/local/share/aap"):
    AAPSYSDIR = /usr/local/share/aap
@else:
    AAPSYSDIR =

CFLAGS ?=
CXXFLAGS ?= $CFLAGS
LDFLAGS ?=
CPPFLAGS ?=

OPTIMIZE ?= 2

DEFAULTCHECK = md5

# Check if $CC exists.  If not, try looking for "gcc".
CC ?= cc
@if not program_path(CC) and program_path('gcc'):
   CC = gcc

# If $CXX was not set yet, use g++ if it exists, otherwise use $CC.
CXX ?= 
@if not program_path(CXX) and program_path('g++'):
    CXX = g++
CXX ?= $CC

# OBJSUF actually depends on the compiler, the tool should correct it.
@if os.name in [ 'nt', 'dos', 'os2' ]:
    OBJSUF = .obj
    LIBOBJSUF = .obj
    DLLOBJSUF = .sob
    EXESUF = .exe
    LIBPRE =
    LIBSUF = .lib
    DLLPRE =
    DLLSUF = .dll
    LNKSUF =
@else:
    OBJSUF = .o
    LIBOBJSUF = .o
    DLLOBJSUF = .sho
    EXESUF =
    LIBPRE = lib
    LIBSUF = .a
    DLLPRE = lib
    DLLSUF = .so
    LNKSUF =
    # XXX this should be in a separate Irix recipe...
    @if string.find(sys.platform, "irix") >= 0 and program_path("CC"):
	# static and shared objects are the same.
	DLLOBJSUF = .o
	CXXFLAGS = $CXXFLAGS -LANG:std

# used in add_build_one()
LTOBJSUF = .lo


# Check if $CC ($CXX) is GCC, remember this in $HASGCC ($HASGCCXX)
# Use a dependency to avoid checking it more than once.
# Use an action to share the code between checking $CC and $CXX.
# TODO: handle the situation that $CC is not gcc but "gcc" does exist.
HASGCC =
HASGCCXX =

:action gcccheck default
    @if _no.get("check_cpp"):
        val = $_recipe.HASGCCXX
    @else:
        val = $_recipe.HASGCC
    @if val == '':
        val = no            # default result
        MESSAGE = error	    # Don't echo the commands here
        @try:
            testfile = `tempfname()`.c
            outfile = `tempfname()`
            :eval "#ifdef __GNUC__\nyes;\n#endif\n" >! $testfile
            @if _no.get("check_cpp"):
                :sys $CXX -E $testfile > $outfile
            @else:
                :sys $CC -E $testfile > $outfile
            :cat $outfile | :assign tt
            @if string.find(tt, "yes") >= 0:
                val = yes
        @except (StandardError, UserError), e:
            :log Warning: could not test C compiler for being GCC: `str(e)`
        :del {force}{quiet} $testfile $outfile
        @if _no.get("check_cpp"):
            _recipe.HASGCCXX = $val
        @else:
            _recipe.HASGCC = $val


# Depending on the platform, check for available toolchains.
# Actions are installed for every toolchain that exists.
# The first one found sets $C_COMPILE_ACTION and friends: it is used as
# default.  Uses ideas from SCons.
@if osname() == 'mswin':
    :toolsearch msvc mingw gcc icc bcc
@elif osname() == 'os2':
    :toolsearch icc gcc msvc

# Get the time, so that it remains the same while executing the recipe.
:python
    import time
    GMTIME = time.gmtime(time.time())
    DATESTR = time.strftime("%Y %b %d", GMTIME)
    TIMESTR = time.strftime("%X", GMTIME)

# Default depedency checkers

# GCC can detect included files better than we can, it works recursively.
# If GCC is not available, use an internal function.
:action depend {recursive}
	{buildcheck = $($)CC $($)CXX $($)CFLAGS $($)CXXFLAGS $($)CPPFLAGS
						      $($)?DEFINE $($)?INCLUDE}
	c,cpp
    @if filetype == 'c':
        @if _no.HASGCC == '':
            :do gcccheck dummy
	usegcc = $HASGCC
	cc = $CC
	flags = $CFLAGS
    @else:
        @if _no.HASGCCXX == '':
            :do gcccheck {check_cpp} dummy
	usegcc = $HASGCCXX
	cc = $CXX
	flags = $CXXFLAGS
    @if usegcc != "yes":
    @   aap_depend_c(globals(), source, target, flags = flags)
    @else:
	# Buggy version of gcc on Mac OS X doesn't accept "-E -MM" for ".c"
	# files but "-E" is required for ".h" files...
	ss = $-source
	@if fname_fold(suffix(ss)) in ['h', 'H', 'hh', 'hpp', 'hxx']:
	    EEE = -E
	@else:
	    EEE =
	:sysdepend {filepat = .*: ([^:]*): No such file or directory}
		    $cc $CPPFLAGS $?DEFINE $?INCLUDE $flags $?CDEPFLAGS
						   $EEE -MM $-source > $-target

#
# Default A-A-P commands for action-filetype pairs.
# Related default rules are mixed in.
#

# :do edit

@if os.name == "posix":
    EDITOR = `os.environ.get('VISUAL', os.environ.get('EDITOR', 'vi'))`
@else:
    EDITOR = `os.environ.get('VISUAL', os.environ.get('EDITOR', 'notepad'))`
:action edit default
    @if globals().has_key('line') and os.path.basename(EDITOR)[:2] == "vi":
	:sys {i} $EDITOR +$line $source
    @elif globals().has_key('byte') and os.path.basename(EDITOR)[:3] == "vim":
	:sys {i} $EDITOR -c "go $byte" $source
    @else:
	:sys {i} $EDITOR $source

PAINTER = `os.environ.get('PAINTER')`
:action edit gif,jpeg,png
    @if not _no.PAINTER:
       :progsearch _recipe.PAINTER gimp kpaint
    :syspath '$PAINTER' $source

# :do view

# Use the $BROWSER environment variable, a proposed standard; colon separated
# alternatives.  If not set, search for one of the known browsers.
BROWSER = `os.environ.get('BROWSER')`
:action view html,xml,php
    @if not _no.BROWSER:
       :progsearch _recipe.BROWSER netscape mozilla konquerer grail iexplore mosaic lynx w3m
    :syspath '$BROWSER' $source

@if os.name == "posix":
    PAGER = `os.environ.get('PAGER', 'more')`
@else:
    PAGER = `os.environ.get('PAGER', '')`
:action view default
    @if PAGER:		    # assume $PAGER can handle multiple files
	@if (globals().has_key('line')
	@	and (os.path.basename(PAGER)[:4] == "more"
	@	    or os.path.basename(PAGER)[:4] == "less")):
	   :sys {i} $PAGER +$line $source
        @else:
	   :sys {i} $PAGER $source
    @else:		    # MS-Windows more always reads from stdin
    @  for fname in var2list(source):
          :sys {i} more <$fname

:action view gif,jpeg,png
    :sys xv $source


# :do compile

:python
    define_action("compile", 1, """
        @if not _no.get("target"):
            target = `src2obj(fname)`
        @if DEFER_ACTION_NAME:
            :do $DEFER_ACTION_NAME {target = $target} $source
        @else:
            :buildcheck $OPTIMIZE $?DEBUG
            :sys $CC $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` $CFLAGS -c -o $target $source
        """,
        outtypes = ["object", "libobject", "default"],
        intypes = ["c"],
        defer_var_names = ["C_COMPILE_ACTION", "COMPILE_ACTION"])

:rule {default} %$OBJSUF : {buildcheck = $($)CC $($)CPPFLAGS $($)?DEFINE
			   $($)?INCLUDE $($)OPTIMIZE $($)?DEBUG $($)CFLAGS} %.c
    :do compile {target = $target} $source

:python
    define_action("compile", 1, """
        @if not _no.get("target"):
            target = `src2obj(fname)`
        :attr {buildaction = cxx_build} $target	# Need to build with $CXX
        @if DEFER_ACTION_NAME:
            :do $DEFER_ACTION_NAME {target = $target} $source
        @else:
            :buildcheck $OPTIMIZE $?DEBUG
            :sys $CXX $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` $CXXFLAGS -c -o $target $source
        """,
        outtypes = ["object", "libobject", "default"],
        intypes = ["cpp"],
        defer_var_names = ["CXX_COMPILE_ACTION", "COMPILE_ACTION"])

:rule {default} %$OBJSUF : {buildcheck = $($)CXX $($)CPPFLAGS $($)?DEFINE
					       $($)?INCLUDE $($)CXXFLAGS} %.cpp
    >always
        :attr {buildaction = cxx_build} $target   # Need to build with $CXX
    >build
        :do compile {target = $target} $source

# TODO: this only works for gcc
DLLCFLAGS ?= -fPIC
:python
    define_action("compile", 1, """
        @if not _no.get("target"):
            target = `src2obj(fname, sufname = "DLLOBJSUF")`
        @if DEFER_ACTION_NAME:
            :do $DEFER_ACTION_NAME {target = $target} $source
        @else:
            :buildcheck $OPTIMIZE $?DEBUG
            :sys $CC $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` $CFLAGS $DLLCFLAGS -c -o $target $source
        """,
        outtypes = ["dllobject"],
        intypes = ["c"],
        defer_var_names = ["C_COMPILE_ACTION", "COMPILE_ACTION"])

@if _no.OBJSUF != _no.DLLOBJSUF:
    :rule {default} %$DLLOBJSUF : {buildcheck = $($)CC $($)CPPFLAGS $($)?DEFINE
	     $($)?INCLUDE $($)OPTIMIZE $($)?DEBUG $($)CFLAGS $($)DLLCFLAGS} %.c
	:do compile {target = $target} $source

# TODO: this only works for gcc
DLLCXXFLAGS ?= -fPIC
:python
    define_action("compile", 1, """
        @if not _no.get("target"):
            target = `src2obj(fname, sufname = "DLLOBJSUF")`
        :attr {builddllaction = cxx_builddll} $target	# Need to build with $CXX
        @if DEFER_ACTION_NAME:
            :do $DEFER_ACTION_NAME {target = $target} $source
        @else:
            :buildcheck $OPTIMIZE $?DEBUG
            :sys $CXX $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` $CXXFLAGS $DLLCXXFLAGS -c -o $target $source
         """,
        outtypes = ["dllobject"],
        intypes = ["cpp"],
        defer_var_names = ["CXX_COMPILE_ACTION", "COMPILE_ACTION"])

@if _no.OBJSUF != _no.DLLOBJSUF:
    :rule {default} %$DLLOBJSUF : {buildcheck = $($)CXX $($)CPPFLAGS
		   $($)?DEFINE $($)?INCLUDE $($)CXXFLAGS $($)DLLCXXFLAGS} %.cpp
      >always
        :attr {builddllaction = cxx_builddll} $target   # Need to build with $CXX
      >build
	:do compile {target = $target} $source

# :do preproc

:action preproc default c,cpp
    @if not _no.get("target"):
	target = `src2obj(fname, sufname = None)` + ".i"
    :sys $CC $CPPFLAGS $?DEFINE $?INCLUDE -E $source > $target


# :do lex, lexpp

LEX ?=
:python
    define_action("lex", 1, """
        @if not _no.LEX:
          # Prefer flex above lex, it should be able to do everything lex can.
          :progsearch _recipe.LEX flex lex
          @if not _no.LEX:
            :error Cannot find a lex program
        @if _no.get("target"):
            :sys $LEX $?LEXFLAGS -o$target $source
        @else:
            :sys $LEX $?LEXFLAGS $source
        """,
        outtypes = ["c"],
        intypes = ["lex"],
        outfilename = "$(source).c")

:rule {default}{sourceexists} %.c : {buildcheck = $($)LEX $($)?LEXFLAGS} %.l
    :do lex {target = $target} $source


LEXPP ?=
:python
    define_action("lexpp", 1, """
        @if not _no.LEXPP:
          # Prefer flex above lex, it should be able to do everything lex can.
          :progsearch _recipe.LEXPP flex++ lex++ flex lex
          @if not _no.LEXPP:
            :error Cannot find a lex program
        @if _no.get("target"):
            :sys $LEXPP $?LEXPPFLAGS -o$target $source
        @else:
            :sys $LEXPP $?LEXPPFLAGS $source
        """,
        outtypes = ["cpp"],
        intypes = ["lexpp"],
        outfilename = "$(source).cpp")

:rule {default}{sourceexists} %.cpp : {buildcheck = $($)LEXPP $($)?LEXPPFLAGS}
									   %.ll
    :do lexpp {target = $target} $source


# :do yacc

YACC ?=
:python
    define_action("yacc", 1, """
        @if not _no.YACC:
          # Find bison first, it's supposed to do more than yacc.
          :progsearch _recipe.YACC yacc bison
          @if not _no.YACC:
            :error Cannot find a yacc program
        @if _no.get("target"):
            :sys $YACC $?YACCFLAGS -o $target $source
        @else:
            :sys $YACC $?YACCFLAGS $source
        """,
        outtypes = ["c"],
        intypes = ["yacc"],
        outfilename = "$(source).c")

:rule {default}{sourceexists} %.c : {buildcheck = $($)YACC $($)?YACCFLAGS} %.y
    :do yacc {target = $target} $source

YACCPP ?=
:python
    define_action("yaccpp", 1, """
        @if not _no.YACCPP:
            # Find bison first, it's supposed to do more than yacc.
            :progsearch _recipe.YACCPP bison yacc
            @if not _no.YACCPP:
                :error Cannot find a yacc program
        @if _no.get("target"):
            :sys $YACCPP $?YACCPPFLAGS -o $target $source
        @else:
            :sys $YACCPP $?YACCPPFLAGS $source
        """,
        outtypes = ["cpp"],
        intypes = ["yaccpp"],
        outfilename = "$(source).cpp")

:rule {default}{sourceexists} %.cpp : {buildcheck = $($)YACCPP
							 $($)?YACCPPFLAGS} %.yy
    :do yaccpp {target = $target} $source


# :do build

# The generic build action.  May invoke a language-specific build action.
:python
    act = define_action("build", 1, """
        @if DEFER_ACTION_NAME:
            # Building is handled by a specific action.
            :do $DEFER_ACTION_NAME {target = $target} $source
        @else:
            ld = $?LD
            @if not ld:
                # No linker specified by the user, use $CC.
                ld = $CC
            :buildcheck $OPTIMIZE $?DEBUG
            :sys $ld $LDFLAGS `cflags_normal()` -o $target $source $?LIBS
        """,
        outtypes = ["default"],
        intypes = ["object", "libobject", "ltobject", "dll", "default"])
    def default_build_defer_name(source = ""):
        if _no.get("BUILD_ACTION"):
            return var2string(_no.BUILD_ACTION)
        name = get_var_attr(source, "buildaction")
        if name:
            return name
        if _no.get("C_BUILD_ACTION"):
            return var2string(_no.C_BUILD_ACTION)
        if _no.get("LTLIBS"):
            return ltbuild
        return None
    act.defer_action_name = default_build_defer_name

# The C++ build action.
:python
    act = define_action("cxx_build", 0, """
        @if DEFER_ACTION_NAME:
            :do $DEFER_ACTION_NAME {target = $target} $source
        @else:
            ld = $?LD
            @if not ld:
                # No linker specified by the user, use $CXX.
                ld = $CXX
            :buildcheck $OPTIMIZE $?DEBUG
            :sys $ld $LDFLAGS `cflags_normal()` -o $target $source $?LIBS
        """,
        outtypes = ["default"],
        intypes = ["object", "libobject", "ltobject", "dll", "default"])
    def default_cxx_build_defer_name(source = ""):
        if _no.get("CXX_BUILD_ACTION"):
            return var2string(_no.CXX_BUILD_ACTION)
        if _no.get("LTLIBS"):
            return ltbuild_cxx
        return None
    act.defer_action_name = default_cxx_build_defer_name


# :do buildlib

@if os.name in [ 'nt', 'dos', 'os2' ]:
    AR ?= lib
    ARFLAGS ?= /nologo
    :python
        define_action("buildlib", 1, """
                @if DEFER_ACTION_NAME:
                    :do $DEFER_ACTION_NAME {target = $target} $source
                @else:
                    :sys $AR $ARFLAGS /OUT:$target $source
                """,
                outtypes = ["default"],
                intypes = ["libobject", "object", "default"],
                defer_var_names = ["BUILDLIB_ACTION", "{buildlibaction}"])
@else:
    AR ?= ar
    ARFLAGS ?= r
    findranlibprog {virtual}:
	:progsearch _recipe.RANLIB ranlib
    :python
        define_action("buildlib", 1, """
                @if DEFER_ACTION_NAME:
                    :do $DEFER_ACTION_NAME {target = $target} $source
                @else:
                    :sys $AR $ARFLAGS $target $source
                    @if not _no.has_key("RANLIB"):
                       :update findranlibprog
                    @if _no.get("RANLIB"):
                       :sys $RANLIB $?RANLIBFLAGS $target
                """,
                outtypes = ["default"],
                intypes = ["libobject", "object", "default"],
                defer_var_names = ["BUILDLIB_ACTION", "{buildlibaction}"])


# :do builddll

@if os.name in [ 'nt', 'dos', 'os2' ]:
    # XXX not tested at all!
    SHLINK ?= link
    SHLINKFLAGS ?= /nologo /dll
    :python
        define_action("builddll", 1, """
                @if DEFER_ACTION_NAME:
                    :do $DEFER_ACTION_NAME {target = $target} $source
                @else:
                    :sys $SHLINK $SHLINKFLAGS /OUT:$target $source
                """,
                outtypes = ["default"],
                intypes = ["dllobject", "default"],
                defer_var_names = ["BUILDDLL_ACTION", "{builddllaction}"])

    :python
        # TODO: Is this correct?
        act = define_action("cxx_builddll", 1, """
                :do builddll {target = $target} $source
                """,
                outtypes = ["default"],
                intypes = ["dllobject", "default"])
        def default_cxx_builddll_defer_name(source = ""):
            return "builddll"
        act.defer_action_name = default_cxx_builddll_defer_name

@else:
    SHLINK ?= ld
    SHLINKFLAGS ?= -shared
    :python
        define_action("builddll", 1, """
                @if DEFER_ACTION_NAME:
                    :do $DEFER_ACTION_NAME {target = $target} $source
                @else:
                    :sys $SHLINK $LDFLAGS $SHLINKFLAGS -o $target $source
                """,
                outtypes = ["default"],
                intypes = ["dllobject", "default"],
                defer_var_names = ["BUILDDLL_ACTION", "{builddllaction}"])

    CXXSHLINK ?= $CXX
    CXXSHLINKFLAGS ?= -shared
    :python
        define_action("cxx_builddll", 1, """
                @if DEFER_ACTION_NAME:
                    :do $DEFER_ACTION_NAME {target = $target} $source
                @else:
                    :sys $CXXSHLINK $LDFLAGS $CXXSHLINKFLAGS -o $target $source
                """,
                outtypes = ["default"],
                intypes = ["dllobject", "default"],
                defer_var_names = ["CXX_BUILDDLL_ACTION"])

# :do email

MAILER = `os.environ.get('MAILER', 'mail')`
:action email default
    @if globals().get("edit"):
	:do edit $fname
    :sys $MAILER -s $subject $to <$fname


# :do reference

REFERENCER =
:action reference default
    @if not _no.REFERENCER:
	:progsearch _recipe.REFERENCER aref ctags
    @if os.path.basename(var2string(_no.REFERENCER)) == "aref":
	:sys $REFERENCER -u $source
    @else:
	:sys $REFERENCER $source
    
# :do strip
findstripprog {virtual}:
    :progsearch _recipe.STRIP strip
:action strip default
    @if not _no.get("STRIP"):
       :update findstripprog
    :sys $STRIP $?STRIPFLAGS $source

# :do extract
TAR = tar 
BUNZIP2 = bunzip2
UNZIP = unzip
:action extract tar
    @if _no.TAR == 'tar':
        :assertpkg tar
    :sys $TAR xf $source
:action extract targz
    @if _no.TAR == 'tar':
        :assertpkg tar
    :sys $TAR xzf $source
:action extract tarbz2
    @if _no.BUNZIP2 == 'bunzip2':
        :assertpkg bunzip2 tar
    :sys $BUNZIP2 -c $source | $TAR xf -
:action extract zip
    @if _no.UNZIP == 'unzip':
        :assertpkg unzip
    :sys $UNZIP $source

#
# INSTALL and UNINSTALL actions
#

PREFIX ?= /usr/local
DESTDIR ?=

# :do installexec/uninstallexec
EXECMODE ?= 0755
EXECDIR ?= bin/
:action installexec default 
    @if not _no.has_key("STRIP"):
       :update findstripprog
    dest = $EXECDIR
    @install_files(dest, source, var2string(_no.EXECMODE), strip = 1)
:action uninstallexec default
    dest = $EXECDIR
    @uninstall_files(dest, source)

# :do installsbin/uninstallsbin
SBINDIR ?= sbin/
:action installsbin default 
    dest = $SBINDIR
    @install_files(dest, source, var2string(_no.EXECMODE))
:action uninstallsbin default
    dest = $SBINDIR
    @uninstall_files(dest, source)

# :do installlib/uninstalllib
LIBDIR ?= lib/
LIBMODE ?= 0644
:action installlib default 
    dest = $LIBDIR
    @install_files(dest, source, var2string(_no.LIBMODE))
:action uninstalllib default
    dest = $LIBDIR
    @uninstall_files(dest, source)

# :do installdll/uninstalldll
DLLDIR ?= lib/
DLLMODE ?= 0755
:action installdll default 
    dest = $DLLDIR
    @install_files(dest, source, var2string(_no.DLLMODE))
:action uninstalldll default
    dest = $DLLDIR
    @uninstall_files(dest, source)

# :do installconf/uninstallconf
CONFDIR ?= etc/
CONFMODE ?= 0644
:action installconf default 
    dest = $CONFDIR
    @install_files(dest, source, var2string(_no.CONFMODE))
:action uninstallconf default
    dest = $CONFDIR
    @uninstall_files(dest, source)

# :do installdata/uninstalldata
DATADIR ?= share/
DATAMODE ?= 0644
:action installdata default 
    @if _no.get("PKGNAME") == None:
	:error For installing data you must set $($)PKGNAME
    dest = $DATADIR$PKGNAME
    @install_files(dest, source, var2string(_no.DATAMODE))
:action uninstalldata default
    @if _no.get("PKGNAME") == None:
	:error For installing data you must set $($)PKGNAME
    dest = $DATADIR$PKGNAME
    @uninstall_files(dest, source)

# :do installman/uninstallman
MANDIR ?= man/
MANMODE ?= 0644
:action installman default 
    dest = $MANDIR
    @install_files(dest, source, var2string(_no.MANMODE), mandir = 1)
:action uninstallman default
    dest = $MANDIR
    @uninstall_files(dest, source, mandir = 1)

# :do installinfo/uninstallinfo
INFODIR ?= info/
INFOMODE ?= 0644
:action installinfo default 
    dest = $INFODIR
    @install_files(dest, source, var2string(_no.INFOMODE))
:action uninstallinfo default
    dest = $INFODIR
    @uninstall_files(dest, source)

# :do installinclude/uninstallinclude
INCLUDEDIR ?= include/
INCLUDEMODE ?= 0644
:action installinclude default 
    dest = $INCLUDEDIR
    @install_files(dest, source, var2string(_no.INCLUDEMODE))
:action uninstallinclude default
    dest = $INCLUDEDIR
    @uninstall_files(dest, source)

# vim: set sw=4 sts=4 tw=79 :