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
:= apply_path.c change_dir.c command_loop.c enable_passive.c \
14 expand_arg.c file_stats.c init_session.c list_dir.c log.c \
15 next_command.c open_data_channel.c parse_port_argument.c reply.c \
20 # Phony targets and aliases
23 .PHONY
: all debug
clean distclean help
30 # Binaries (release and debug)
33 uftps
: $(SOURCES
:.c
=.o
)
34 @echo
' Linking $@' && $(CC
) $(LDFLAGS
) -o
$@
$^
36 uftps.dbg
: $(SOURCES
:.c
=.dbg.o
)
37 @echo
' Linking [debug] $@' && $(CC
) $(LDFLAGS_DBG
) -o
$@
$^
46 @echo
' Compiling [tuned] $@' && $(CC
) $(CFLAGS
) $(ARCH
) -c
-o
$@
$<
48 @echo
' Compiling $@' && $(CC
) $(CFLAGS
) -c
-o
$@
$<
52 @echo
' Compiling [debug] $@' && $(CC
) $(CFLAGS_DBG
) -c
-o
$@
$<
59 next_command.o
: command_parser.h
60 next_command.dbg.o
: command_parser.h
62 command_parser.h
: command_parser.gperf
63 @echo
' Generating $@' && gperf
--output-file
=$@
$<
74 @
-rm -fv uftps uftps.dbg command_parser.h
79 @echo
' all - Default target. Build the UFTPS binary.'
80 @echo
' debug - Build the UFTPS binary with debugging support.'
81 @echo
' clean - Clean object files.'
82 @echo
' distclean - Clean binaries and the command parser (clean implied).'
84 @echo
'NOTE: Enable custom optimization flags for the release binary'
85 @echo
' defining the ARCH make variable. For example:'
87 @echo
' make "ARCH=-march=pentium-m -mfpmath=sse" all'
92 # Include dependecy information if necessary
94 ifneq ($(findstring clean,$(MAKECMDGOALS
)),clean)
95 ifneq ($(findstring help
,$(MAKECMDGOALS
)),help
)
96 -include $(patsubst %.c
,.
%.d
,$(SOURCES
))