File tree Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Expand file tree Collapse file tree 1 file changed +22
-20
lines changed Original file line number Diff line number Diff line change 1- prefix = /usr/local
2-
1+ PREFIX ?= /usr
2+ DESTDIR ?=
3+ BINDIR ?= $(PREFIX ) /bin
34CFLAGS ?= -g -O2
4-
55INSTALL ?= install
66PKG_CONFIG ?= pkg-config
77
88ifeq ($(shell $(PKG_CONFIG ) --exists libsystemd || echo NO) ,)
9- DEFS += -DHAVE_SYSTEMD_SD_DAEMON_H $(shell $(PKG_CONFIG ) --cflags libsystemd)
10- LDADD += $(shell $(PKG_CONFIG ) --libs libsystemd)
9+ CPPFLAGS += -DHAVE_SYSTEMD_SD_DAEMON_H $(shell $(PKG_CONFIG ) --cflags libsystemd)
10+ LDLIBS += $(shell $(PKG_CONFIG ) --libs libsystemd)
1111endif
1212
13- CPPFLAGS += $(DEFS ) $(INCLUDES )
13+ CFLAGS += -MMD -MP
14+ CFLAGS += -Wall -Wextra
1415
1516OBJECTS := log.o network.o utils.o udptunnel.o
1617
17- all : depend udptunnel
18+ ifneq ($(V ) ,1)
19+ BUILT_IN_LINK.o := $(LINK.o )
20+ LINK.o = @echo " LD $@ ";
21+ LINK.o += $(BUILT_IN_LINK.o )
22+ BUILT_IN_COMPILE.c := $(COMPILE.c )
23+ COMPILE.c = @echo " CC $@ ";
24+ COMPILE.c += $(BUILT_IN_COMPILE.c )
25+ endif
26+
27+ all : udptunnel
1828
19- install :
20- $(INSTALL ) -d $(BASEDIR )$(prefix ) /sbin/
21- $(INSTALL ) -m 0755 udptunnel $(BASEDIR )$(prefix ) /sbin/
29+ install : udptunnel
30+ @$(INSTALL ) -v -d " $( DESTDIR) $( BINDIR) " && install -v -m 0755 udptunnel " $( DESTDIR) $( BINDIR) /udptunnel"
2231
2332clean :
24- rm -f Makefile.depend $(OBJECTS ) udptunnel
25-
26- % .o : % .c
27- $(CC ) $(CPPFLAGS ) $(CFLAGS ) -c $<
33+ @$(RM ) -vf $(OBJECTS ) $(OBJECTS:%.o=%.d ) udptunnel
2834
2935udptunnel : $(OBJECTS )
30- $(CC ) $(CFLAGS ) $(LDFLAGS ) -o $@ $^ $(LDADD ) $(LIBS )
31-
32- depend : Makefile.depend
33- Makefile.depend :
34- $(CC ) $(CPPFLAGS ) $(CFLAGS ) -MM -MG * .c > $@
3536
36- -include Makefile.depend
37+ .PHONY : all install clean
38+ -include *.d
You can’t perform that action at this time.
0 commit comments