4 # To display this Makefile help use: make help
9 HCC
:= i586-mingw32msvc-gcc
10 CFLAGS
:= -O2
-Wall
-pipe
-fomit-frame-pointer
11 CFLAGS_DBG
:= -O0
-Wall
-pipe
-g
-pg
-DDEBUG
12 LDFLAGS
:= -Wall
-pipe
-Wl
,-s
,-O1
13 LDFLAGS_DBG
:= -Wall
-pipe
-g
-pg
14 #LDFLAGS := -lsocket -lnsl
15 #LDFLAGS_DBG := -lsocket -lnsl -g -pg
17 SOURCES
:= change_dir.c command_loop.c enable_passive.c expand_arg.c \
18 file_stats.c init_session.c list_dir.c log.c next_command.c \
19 open_data_channel.c open_file.c parse_port_argument.c reply.c \
22 SOURCES_unix
:= $(SOURCES
) main-unix.c
23 SOURCES_hase
:= $(SOURCES
) main-hase.c
27 # Phony targets and aliases
30 .PHONY
: all debug
clean distclean help
39 # Binaries (release and debug)
42 uftps
: $(SOURCES_unix
:.c
=.o
)
43 @echo
' Linking $@' && $(CC
) $(LDFLAGS
) -o
$@
$^
45 uftps.dbg
: $(SOURCES_unix
:.c
=.dbg.o
)
46 @echo
' Linking [debug] $@' && $(CC
) $(LDFLAGS_DBG
) -o
$@
$^
48 uftps.exe
: $(SOURCES_hase
:.c
=.obj
)
49 @echo
' Linking [win32] $@' && $(HCC
) $(LDFLAGS
) -o
$@
$^
-lws2_32
51 uftps.dbg.exe
: $(SOURCES_hase
:.c
=.dbg.obj
)
52 @echo
' Linking [win32] [debug] $@' && $(HCC
) $(LDFLAGS_DBG
) -o
$@
$^
-lws2_32
61 @echo
' Compiling [tuned] $@' && $(CC
) $(CFLAGS
) $(ARCH
) -c
-o
$@
$<
63 @echo
' Compiling $@' && $(CC
) $(CFLAGS
) -c
-o
$@
$<
66 %.obj
: %.c uftps.h hase.h
68 @echo
' Compiling [win32] [tuned] $@' && $(HCC
) $(CFLAGS
) $(ARCH
) -c
-o
$@
$<
70 @echo
' Compiling [win32] $@' && $(HCC
) $(CFLAGS
) -c
-o
$@
$<
74 @echo
' Compiling [debug] $@' && $(CC
) $(CFLAGS_DBG
) -c
-o
$@
$<
76 %.dbg.obj
: %.c uftps.h hase.h
77 @echo
' Compiling [win32] [debug] $@' && $(HCC
) $(CFLAGS_DBG
) -c
-o
$@
$<
84 next_command.o
: command_parser.h
85 next_command.dbg.o
: command_parser.h
86 next_command.obj
: command_parser.h
87 next_command.dbg.obj
: command_parser.h
89 command_parser.h
: command_parser.gperf
90 @echo
' Generating $@' && gperf
--output-file
=$@
$<
98 @
-rm -f
*.o
*.obj gmon.out uftps uftps.dbg uftps.exe uftps.dbg.exe
101 @
-rm -f command_parser.h
104 @echo
'User targets:'
106 @echo
' all - Default target. Build the UNIX binary.'
107 @echo
' debug - Build the UNIX binary with debugging support.'
108 @echo
' hase - Build the Hasefroch binary.'
109 @echo
' dhase - Build the Hasefroch binary with debugging support.'
110 @echo
' clean - Clean object and binary files.'
111 @echo
' distclean - Clean the command parser (clean implied).'
113 @echo
'You can also choose which RETR implementation to use by setting the'
114 @echo
'RETR make variable to one of these values:'
116 @echo
' generic - Generic multiplatform implementation using read() and'
117 @echo
' send(). Works everyhere but it is the least memory'
118 @echo
' efficient. This is the default value when none selected.'
119 @echo
' mmap - Generic UNIX implementation using mmap() instead of '
120 @echo
' read() to save some memory copies.'
121 @echo
' linux - Linux (2.2 and above) version using the sendfile() system'
123 @echo
' splice - Linux (2.6.17 and above) version which uses the new '
124 @echo
' splice() system call. Requires glibc 2.5 or higher.'
125 @echo
' This is the recommended choice for Linux if you satisfy'
126 @echo
' the requisites.'
127 @echo
' hasefroch - Hasefroch tuned implementation using TransmitFile() and'
128 @echo
' file mapping as a fallback. Requires WinSock 2.2'
130 @echo
'For example, to select the mmap RETR implementation, the compilation'
131 @echo
'command line can be:'
133 @echo
' make RETR=mmap'
135 @echo
'Finally, to enable custom optimization flags for the release binary,'
136 @echo
'define the ARCH make variable. For example:'
138 @echo
' make "ARCH=-march=pentium-m -mfpmath=sse" all'