summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile91
1 files changed, 27 insertions, 64 deletions
diff --git a/src/Makefile b/src/Makefile
index bdee4fe..f5eea2c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -32,88 +32,51 @@
## along with ľAnytun. If not, see <http://www.gnu.org/licenses/>.
##
-TARGET=$(shell uname -s)
-CC = gcc
-CCFLAGS = -g -O2 -DANYTUN_02_COMPAT #-DUSE_SSL_CRYPTO #-DNO_CRYPT
-LD = gcc
-LDFLAGS = -g -Wall -O2 -lgcrypt -lgpg-error #-lcrypto
-
-ifeq ($(TARGET),Linux)
- LDFLAGS += -ldl
-endif
-ifeq ($(TARGET),OpenBSD)
- CCFLAGS += -I/usr/local/include -DNO_UDPV6
- LDFLAGS += -L/usr/local/lib
-endif
-
-CRYPT_OBJS = key_derivation.o \
- auth_algo.o
-
-OBJS = log.o \
- signal.o \
- options.o \
- tun.o \
- udp.o \
- plain_packet.o \
- encrypted_packet.o \
- seq_window.o \
- cipher.o \
- uanytun.o
-
-OBJS += $(CRYPT_OBJS)
+include include.mk
+DEPENDFILE = .depend
EXECUTABLE = uanytun
-all: $(EXECUTABLE)
-
-uanytun: $(OBJS)
- $(LD) $(OBJS) -o $@ $(LDFLAGS)
-
-uanytun.o: uanytun.c
- $(CC) $(CCFLAGS) $< -c
-
-log.o: log.c log.h
- $(CC) $(CCFLAGS) $< -c
-
-signal.o: signal.c signal.h
- $(CC) $(CCFLAGS) $< -c
+CRYPT_OBJ = key_derivation.o \
+ auth_algo.o
+OBJ = log.o \
+ signal.o \
+ options.o \
+ tun.o \
+ udp.o \
+ plain_packet.o \
+ encrypted_packet.o \
+ seq_window.o \
+ cipher.o \
+ uanytun.o
-options.o: options.c options.h
- $(CC) $(CCFLAGS) $< -c
+OBJ += $(CRYPT_OBJ)
-tun.o: tun.c tun.h
- $(CC) $(CCFLAGS) $< -c
+SRC = $(OBJ:%.o=%.c)
-udp.o: udp.c udp.h
- $(CC) $(CCFLAGS) $< -c
+.PHONY: dep distclean clean
-plain_packet.o: plain_packet.c plain_packet.h
- $(CC) $(CCFLAGS) $< -c
+all: dep $(EXECUTABLE)
-encrypted_packet.o: encrypted_packet.c encrypted_packet.h
- $(CC) $(CCFLAGS) $< -c
+dep: $(SRC)
+ $(CC) -MM $(SRC) > $(DEPENDFILE)
-seq_window.o: seq_window.c seq_window.h
- $(CC) $(CCFLAGS) $< -c
+-include $(DEPENDFILE)
-key_derivation.o: key_derivation.c key_derivation.h
- $(CC) $(CCFLAGS) $< -c
+uanytun: $(OBJ)
+ $(LD) $(OBJ) -o $@ $(LDFLAGS)
-cipher.o: cipher.c cipher.h
- $(CC) $(CCFLAGS) $< -c
+%.o: %.c
+ $(CC) $(CFLAGS) -c $<
-auth_algo.o: auth_algo.c auth_algo.h
- $(CC) $(CCFLAGS) $< -c
distclean: clean
find . -name *.o -exec rm -f {} \;
find . -name "*.\~*" -exec rm -rf {} \;
+ rm -f include.mk
rm -f tun.c
clean:
rm -f *.o
+ rm -f $(DEPENDFILE)
rm -f $(EXECUTABLE)
-
-ctags:
- ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .
-