Changeset 265


Ignore:
Timestamp:
May 31, 2006, 12:54:53 PM (15 years ago)
Author:
titer
Message:

Split and moved makefiles into a seperate folder, fixes and speed-up to
the retrieving of the SVN revision, OS X packages now show the revision
if this isn't a release build

Location:
trunk
Files:
11 added
7 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1 Makefile.config
        2 Makefile.version
        31.depend
        42build
  • trunk/Makefile

    r264 r265  
    11# $Id$
    22
    3 -include Makefile.config
    4 ifndef CONFIGURE_RUN
    5 $(error You must run ./configure first)
     3include mk/common.mk
     4
     5default: all
     6
     7# Before we do anything else, make sure we have config.mk and an
     8# updated version.mk
     9
     10required: mk/config.mk mk/version.mk
     11mk/config.mk:
     12        @echo "Please run ./configure first."
     13        @false
     14mk/version.mk: FORCE
     15        @echo "Checking SVN revision..."
     16        @./version.sh
     17FORCE:
     18
     19# Now call the Makefile that'll really build
     20# OS X has its special Makefile that wraps to Xcode
     21
     22-include mk/config.mk
     23ifneq ($(SYSTEM),Darwin)
     24REALMAKE = $(MAKE) -f mk/default.mk
     25else
     26REALMAKE = $(MAKE) -f mk/osx.mk
    627endif
    728
    8 -include Makefile.version
    9 include Makefile.common
    10 
    11 ifneq ($(SYSTEM),Darwin)
    12 
    13 TARGETS = .cli
    14 ifeq ($(GTK),yes)
    15 TARGETS += .gtk
    16 endif
    17 ifeq ($(SYSTEM),BeOS)
    18 TARGETS += .beos
    19 endif
    20 
    21 all: $(TARGETS)
    22 
    23 .lib: .version
    24         @echo "* Building libtransmission"
    25         @$(MAKE) -C libtransmission
    26 
    27 .cli: .lib
    28         @echo "* Building Transmission CLI client"
    29         @$(MAKE) -C cli
    30 
    31 .gtk: .lib
    32         @echo "* Building Transmission GTK+ client"
    33         @$(MAKE) -C gtk
    34 
    35 .beos: .lib
    36         @echo "* Building Transmission BeOS client"
    37         @make -C beos
    38 
    39 install: all $(foreach SUB,$(TARGETS),.install$(SUB))
    40 
    41 .install.cli: .cli
    42         @echo "* Installing Transmission CLI client"
    43         @$(MAKE) -C cli install
    44 
    45 .install.gtk: .gtk
    46         @echo "* Installing Transmission GTK+ client"
    47         @$(MAKE) -C gtk install
    48 
    49 .install.beos:
    50 
    51 clean:
    52         @$(MAKE) -C libtransmission clean
    53         @$(MAKE) -C cli clean
    54 ifeq ($(GTK),yes)
    55         @$(MAKE) -C gtk clean
    56 endif
    57 ifeq ($(SYSTEM),BeOS)
    58         @$(MAKE) -C beos clean
    59 endif
    60 
    61 else
    62 
    63 all: .version
    64         @$(MAKE) -C macosx
    65         @xcodebuild -alltargets -activeconfiguration | grep -v "^$$"
    66 
    67 clean:
    68         @xcodebuild -alltargets -activeconfiguration clean | grep -v "^$$"
    69         @$(MAKE) -C macosx clean
    70 
    71 MAKELINK = printf "[InternetShortcut]\nURL=http://transmission.m0k.org%s\n"
    72 define PACKAGE_RULE1
    73         $(RM) tmp "Transmission $(VERSION_STRING)" \
    74           Transmission-$(VERSION_STRING).dmg
    75         mkdir -p tmp
    76         cp -r macosx/Transmission.app tmp/
    77         cp AUTHORS tmp/AUTHORS.txt
    78         cp LICENSE tmp/LICENSE.txt
    79         cp NEWS tmp/NEWS.txt
    80         $(MAKELINK) "/" > tmp/Homepage.url
    81         $(MAKELINK) "/forum" > tmp/Forums.url
    82         $(MAKELINK) "/contribute.php" > tmp/Contribute.url
    83 endef
    84 define PACKAGE_RULE2
    85         mv tmp "Transmission $(VERSION_STRING)"
    86         hdiutil create -format UDZO -srcfolder \
    87           "Transmission $(VERSION_STRING)" Transmission-$(VERSION_STRING).dmg
    88         rm -rf "Transmission $(VERSION_STRING)"
    89 endef
    90 
    91 package:
    92         $(PACKAGE_RULE1)
    93         $(PACKAGE_RULE2)
    94 
    95 package-release:
    96         $(PACKAGE_RULE1)
    97         strip -S tmp/Transmission.app/Contents/MacOS/Transmission
    98         $(PACKAGE_RULE2)
    99 
    100 endif
    101 
    102 .version: .version1 .version2
    103 
    104 .version1:
    105         @echo "Checking SVN revision..."
    106         @./version.sh
    107 
    108 .version2:
    109         @$(RM) libtransmission/version.h
    110         @( echo "#define VERSION_MAJOR    $(VERSION_MAJOR)" && \
    111            echo "#define VERSION_MINOR    $(VERSION_MINOR)" && \
    112            echo "#define VERSION_STRING   \"$(VERSION_STRING)\"" && \
    113            echo "#define VERSION_REVISION $(VERSION_REVISION)" ) > \
    114            libtransmission/version.h
    115 
    116 Makefile.version: .version1
     29all: required
     30        @$(REALMAKE) all
     31clean: required
     32        @$(REALMAKE) clean
     33install: required
     34        @$(REALMAKE) install
     35package: required
     36        @$(REALMAKE) package
     37package-release: required
     38        @$(REALMAKE) package-release
  • trunk/configure

    r262 r265  
    285285
    286286#
    287 # Generate Makefile.config
    288 #
    289 rm -f Makefile.config
    290 cat > Makefile.config << EOF
    291 CONFIGURE_RUN  = yes
     287# Generate config.mk
     288#
     289rm -f mk/config.mk
     290cat > mk/config.mk << EOF
    292291SYSTEM         = $SYSTEM
    293292PREFIX         = $PREFIX
  • trunk/version.sh

    r264 r265  
    33# $Id$
    44
     5# Get current SVN revision from Ids in all source files
    56REVMAX=0
    6 
    7 for pattern in '*.[chm]' '*.cpp' '*.po' 'Makefile*' 'configure'; do
    8   for f in `find . -name "$pattern"`; do
    9     REV=`grep '\$Id:' $f | sed 's/.*\$Id: [^ ]* \([0-9]*\) .*/\1/'`
     7for pattern in '*.[chm]' '*.cpp' '*.po' '*.mk'; do
     8  for f in `find . -name "$pattern"` Makefile configure; do
     9    REV=`sed -e '/\$Id:/!d; s/.*\$Id$f`
    1010    if [ -n "$REV" ]; then
    1111      if [ "$REV" -gt "$REVMAX" ]; then
     
    1616done
    1717
    18 rm -f Makefile.version
    19 echo "VERSION_REVISION = $REVMAX" > Makefile.version
     18# Generate files to be included: only overwrite them if changed so make
     19# won't rebuild everything unless necessary
     20replace_if_differs ()
     21{
     22    if cmp $1 $2 > /dev/null 2>&1; then
     23      rm -f $1
     24    else
     25      mv -f $1 $2
     26    fi
     27}
     28
     29# Generate version.mk
     30cp -f mk/version.mk.in mk/version.mk.new
     31echo "VERSION_REVISION = $REVMAX" >> mk/version.mk.new
     32replace_if_differs mk/version.mk.new mk/version.mk
     33
     34# Generate version.h from version.mk
     35grep "^VER" mk/version.mk | sed -e 's/^/#define /g' -e 's/= //g' \
     36    -e 's/\(VERSION_STRING[ ]*\)\(.*\)/\1"\2"/' > \
     37    libtransmission/version.h.new
     38replace_if_differs libtransmission/version.h.new libtransmission/version.h
    2039
    2140exit 0
Note: See TracChangeset for help on using the changeset viewer.