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 client_port.c command_loop.c file_stats.c \
14 init_session.c list_dir.c log.c misc.c next_command.c send_file.c \
15 session_globals.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
$@
$^
44 @echo
' Compiling [tuned] $@' && $(CC
) $(CFLAGS
) $(ARCH
) -c
-o
$@
$<
46 @echo
' Compiling $@' && $(CC
) $(CFLAGS
) -c
-o
$@
$<
50 @echo
' Compiling [debug] $@' && $(CC
) $(CFLAGS_DBG
) -c
-o
$@
$<
53 @echo
' Dependencies $<' && $(CC
) -MM
$< \
54 | awk
-F
: '{printf "$(<:.c=.o) $@:%s\n",$$2; \
55 printf "$(<:.c=.dbg.o) $@:%s\n",$$2}' >$@
61 .next_command.d
: command_list.h
63 command_list.h
: command_list.gperf
64 @echo
' Generating $@' && gperf
--output-file
=$@
$<
75 @
-rm -fv .
*.d uftps uftps.exe uftps.dbg command_list.h
80 @echo
' all - Default target. Build the GNU/Linux binary.'
81 @echo
' debug - Build the GNU/Linux binary with debugging support.'
82 @echo
' clean - Clean object files.'
83 @echo
' distclean - Clean binaries and DFA header (clean implied).'
85 @echo
'NOTE: Enable custom optimization flags for the UNIX binary'
86 @echo
' defining the ARCH make variable. For example:'
88 @echo
' make "ARCH=-march=pentium-m -mfpmath=sse" all'
93 # Include dependecy information if necessary
95 ifneq ($(findstring clean,$(MAKECMDGOALS
)),clean)
96 ifneq ($(findstring help
,$(MAKECMDGOALS
)),help
)
97 -include $(patsubst %.c
,.
%.d
,$(SOURCES
))