4 # To display this Makefile help use: make help
8 CFLAGS
:= -O2
-Wall
-pipe
-fomit-frame-pointer
9 CFLAGS_DBG
:= -O0
-Wall
-pipe
-g
-pg
-DDEBUG
10 LDFLAGS
:= -Wall
-pipe
-Wl
,-s
,-O1
11 LDFLAGS_DBG
:= -Wall
-pipe
-g
-pg
13 SOURCES
:= change_dir.c command_loop.c enable_passive.c expand_arg.c \
14 file_stats.c init_session.c list_dir.c log.c next_command.c \
15 open_data_channel.c parse_port_argument.c reply.c send_file.c uftps.c
19 # Phony targets and aliases
22 .PHONY
: all debug
clean distclean help
29 # Binaries (release and debug)
32 uftps
: $(SOURCES
:.c
=.o
)
33 @echo
' Linking $@' && $(CC
) $(LDFLAGS
) -o
$@
$^
35 uftps.dbg
: $(SOURCES
:.c
=.dbg.o
)
36 @echo
' Linking [debug] $@' && $(CC
) $(LDFLAGS_DBG
) -o
$@
$^
45 @echo
' Compiling [tuned] $@' && $(CC
) $(CFLAGS
) $(ARCH
) -c
-o
$@
$<
47 @echo
' Compiling $@' && $(CC
) $(CFLAGS
) -c
-o
$@
$<
51 @echo
' Compiling [debug] $@' && $(CC
) $(CFLAGS_DBG
) -c
-o
$@
$<
58 next_command.o
: command_parser.h
59 next_command.dbg.o
: command_parser.h
61 command_parser.h
: command_parser.gperf
62 @echo
' Generating $@' && gperf
--output-file
=$@
$<
73 @
-rm -fv uftps uftps.dbg command_parser.h
78 @echo
' all - Default target. Build the UFTPS binary.'
79 @echo
' debug - Build the UFTPS binary with debugging support.'
80 @echo
' clean - Clean object files.'
81 @echo
' distclean - Clean binaries and the command parser (clean implied).'
83 @echo
'NOTE: Enable custom optimization flags for the release binary'
84 @echo
' defining the ARCH make variable. For example:'
86 @echo
' make "ARCH=-march=pentium-m -mfpmath=sse" all'
91 # Include dependecy information if necessary
93 ifneq ($(findstring clean,$(MAKECMDGOALS
)),clean)
94 ifneq ($(findstring help
,$(MAKECMDGOALS
)),help
)
95 -include $(patsubst %.c
,.
%.d
,$(SOURCES
))