Changed passive_mode flag for a more elaborate field.
[uftps.git] / Makefile
blob55340859b55e23c0d6de903af055b94ab6b50d81
2 # User FTP Server
4 # To display this Makefile help use: make help
7 CC ?= gcc
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 \
16 send_file.c uftps.c
20 # Phony targets and aliases
23 .PHONY: all debug clean distclean help
25 all : uftps
26 debug: uftps.dbg
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 $@ $^
41 # Pattern rules
44 %.o: %.c uftps.h
45 ifdef ARCH
46 @echo ' Compiling [tuned] $@' && $(CC) $(CFLAGS) $(ARCH) -c -o $@ $<
47 else
48 @echo ' Compiling $@' && $(CC) $(CFLAGS) -c -o $@ $<
49 endif
51 %.dbg.o: %.c uftps.h
52 @echo ' Compiling [debug] $@' && $(CC) $(CFLAGS_DBG) -c -o $@ $<
56 # Special rules
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=$@ $<
67 # Cleaning and help
70 clean:
71 @-rm -fv *.o gmon.out
73 distclean: clean
74 @-rm -fv uftps uftps.dbg command_parser.h
76 help:
77 @echo 'User targets:'
78 @echo ''
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).'
83 @echo ''
84 @echo 'NOTE: Enable custom optimization flags for the release binary'
85 @echo ' defining the ARCH make variable. For example:'
86 @echo ''
87 @echo ' make "ARCH=-march=pentium-m -mfpmath=sse" all'
88 @echo ''
92 # Include dependecy information if necessary
94 ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
95 ifneq ($(findstring help,$(MAKECMDGOALS)),help)
96 -include $(patsubst %.c,.%.d,$(SOURCES))
97 endif
98 endif