source: trunk/mk/common.mk @ 1125

Last change on this file since 1125 was 947, checked in by titer, 15 years ago

List libT.a before the -l* flags on the command line (otherwise this can cause problems with LDFLAGS=-Wl,--as-needed)

Patch by Daniel T. Lin

  • Property svn:keywords set to Date Rev Author Id
File size: 1.8 KB
Line 
1# $Id: common.mk 947 2006-09-28 16:04:06Z livings124 $
2
3TMPCFLAGS   = -g -Wall -W -D_FILE_OFFSET_BITS=64 \
4              -D_LARGEFILE_SOURCE -D_GNU_SOURCE \
5              -DSYS_$(shell echo $(SYSTEM) | tr a-z A-Z)
6TMPCXXFLAGS = $(TMPCFLAGS)
7TMPLDFLAGS  =
8
9ifeq ($(SYSTEM),BeOS)
10TMPCXXFLAGS += -Wno-multichar
11ifeq ($(BEOS_NETSERVER),yes)
12TMPCFLAGS  += -DBEOS_NETSERVER
13TMPLDFLAGS += -lnet
14else
15TMPLDFLAGS += -lbind -lsocket
16endif
17endif
18
19ifeq ($(PTHREAD),yes)
20ifneq ($(filter FreeBSD OpenBSD,$(SYSTEM)),)
21TMPCFLAGS  += -pthread
22TMPLDFLAGS += -pthread
23else
24TMPLDFLAGS += -lpthread
25endif
26endif
27
28ifeq ($(OPENSSL),yes)
29TMPCFLAGS  += -DHAVE_OPENSSL
30TMPLDFLAGS += -lcrypto
31endif
32
33CFLAGS   := $(TMPCFLAGS) $(CFLAGS)
34CXXFLAGS := $(TMPCXXFLAGS) $(CXXFLAGS)
35LDFLAGS  := $(TMPLDFLAGS) $(LDFLAGS)
36
37#
38# Utils
39#
40
41define DEP_RULE
42        @echo "Checking dependencies..."
43        @$(RM) .depend
44        @$(foreach SRC, $(SRCS), $(CC) -MM $(SRC) $(CFLAGS) >> .depend;)
45endef
46
47define CC_RULE
48        @echo "Cc $@"
49        @CMD="$(CC) $(CFLAGS) -o $@ -c $<"; $$CMD || \
50          ( echo "Compile line for $@ was:"; echo $$CMD; false )
51endef
52
53define LINK_RULE
54        @echo "Link $@"
55        @CMD="$(CC) -o $@ $(OBJS) $(LDLIBS) $(LDFLAGS)"; $$CMD || \
56          ( echo "Compile line for $@ was:"; echo $$CMD; false )
57endef
58
59define MSGFMT_RULE
60       @echo "Msgfmt $<"
61       @msgfmt -f $< -o $@
62endef
63
64define INSTALL_BIN_RULE
65       @echo "Install $<"
66       @$(MKDIR) $(DESTDIR)$(PREFIX)/bin
67       @$(CP) $< $(DESTDIR)$(PREFIX)/bin/
68endef
69
70define INSTALL_LOCALE_RULE
71       @echo "Install $<"
72       @$(MKDIR) $(DESTDIR)$(LOCALEDIR)/$*/LC_MESSAGES
73       @$(CP) $< $(DESTDIR)$(LOCALEDIR)/$*/LC_MESSAGES/transmission-gtk.mo
74endef
75
76define INSTALL_MAN_RULE
77        @echo "Install $<"
78        @$(MKDIR) $(DESTDIR)$(PREFIX)/man/man1
79        @$(CP) $< $(DESTDIR)$(PREFIX)/man/man1/
80endef
81
82RM    = rm -Rf
83CP    = cp -f
84MKDIR = mkdir -p
85MAKE += --no-print-directory
Note: See TracBrowser for help on using the repository browser.