Revert "debug; set -x to config"
[aiccu.git] / unix-console / Makefile
blobd5e5c071ce53e45d527727aa68680985b3f87c3b
1 # /**********************************************************
2 # SixXS - Automatic IPv6 Connectivity Configuration Utility
3 # ***********************************************************
4 # Copyright 2003-2005 SixXS - http://www.sixxs.net
5 # ***********************************************************
6 # unix-client/Makefile - Makefile for the UNIX client
7 # ***********************************************************
8 # $Author: jeroen $
9 # $Id: Makefile,v 1.32 2007-01-15 11:04:27 jeroen Exp $
10 # $Date: 2007-01-15 11:04:27 $
11 # **********************************************************/
13 SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c
14 INCS = ../common/tun.h ../common/aiccu.h ../common/hash_md5.h ../common/hash_sha1.h ../common/common.h ../common/heartbeat.h ../common/tic.h ../common/ayiya.h ../common/resolver.h
15 OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o
17 # New features not fully implemented and thus disabled for now
18 #CFLAGS += -D NEWSTUFF_TSP -D NEWSTUFF_TEEPEE
19 #SRCS += ../common/tsp.c ../common/teepee.c
20 #OBJS += ../common/tsp.o ../common/teepee.o
21 #INCS += ../common/tsp.h ../common/teepee.h
23 # Our very *bliep* set of options to make sure that these things can't cause any issues
24 CWARNS += -W -Wall -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wbad-function-cast -fshort-enums -fstrict-aliasing -fno-common -Wpadded -pedantic -D_REENTRANT
25 # CWARNS += -Wpacked
27 #CFLAGS += $(CWARNS) -D_GNU_SOURCE -D_DEBUG -g3 -O0
28 CFLAGS += $(CWARNS) -D_GNU_SOURCE
29 CC = @gcc
30 RM = rm
32 # Add -O3 when nothing is specified yet
33 ifeq ($(shell echo $(CFLAGS) | grep -c "\-O"),0)
34 CFLAGS += -O3
35 endif
37 # This is a console client
38 CFLAGS += -D AICCU_CONSOLE
40 # GnuTLS Support ?
41 # Used by TIC to secure that communication
42 # Currently defaultly builds only on Linux, but other platforms might easily also support it
43 ifeq ($(shell uname | grep -c "Linux"),1)
44 CFLAGS += -D AICCU_GNUTLS
45 LDFLAGS += -lgnutls
46 endif
48 # Linux
49 ifeq ($(shell uname | grep -c "Linux"),1)
50 CFLAGS += -D_LINUX -D HAS_IFHEAD -D AICCU_TYPE="\"linux\""
51 SRCS += ../common/aiccu_linux.c
52 OBJS += ../common/aiccu_linux.o
53 LDFLAGS += -lpthread -lresolv
54 endif
56 # FreeBSD
57 ifeq ($(shell uname | grep -c "FreeBSD"),1)
58 CFLAGS += -D_FREEBSD
60 # FreeBSD 4.x
61 ifeq ($(shell uname -r | cut -c 1),4)
62 CFLAGS += -D AICCU_TYPE="\"freebsd4\""
63 SRCS += ../common/aiccu_freebsd4.c
64 OBJS += ../common/aiccu_freebsd4.o
65 else
66 # FreeBSD 5.x/6.x/7.x
67 CFLAGS += -D NEED_IFHEAD -D AICCU_TYPE="\"kame\""
68 SRCS += ../common/aiccu_kame.c
69 OBJS += ../common/aiccu_kame.o
70 endif
71 endif
73 # DragonFlyBSD
74 ifeq ($(shell uname | grep -c "DragonFly"),1)
75 CFLAGS += -D_DFBSD -D NEED_IFHEAD -D AICCU_TYPE="\"dragonfly\""
76 SRCS += ../common/aiccu_freebsd4.c
77 OBJS += ../common/aiccu_freebsd4.o
78 CFLAGS += -pthread
79 endif
81 # NetBSD
82 ifeq ($(shell uname | grep -c "NetBSD"),1)
83 CFLAGS += -D_NETBSD -D AICCU_TYPE="\"kame\""
85 # Check if net/if_tun.h has TUNSIFHEAD and enable support for it
86 ifneq ($(shell grep -c TUNSIFHEAD /usr/include/net/if_tun.h 2>/dev/null),1)
87 # Supports TUNSIFHEAD -> AYIYA/l2tp available
88 CFLAGS += -D NEED_IFHEAD
89 else
90 # Doesn't support TUNSIFHEAD -> No AYIYA/l2tp available
91 CFLAGS += -D NO_IFHEAD
92 endif
94 SRCS += ../common/aiccu_kame.c
95 OBJS += ../common/aiccu_kame.o
96 CFLAGS += -pthread -D_NETBSD_SOURCE
97 endif
99 # OpenBSD
100 ifeq ($(shell uname | grep -c "OpenBSD"),1)
101 CFLAGS += -D_OPENBSD -D HAS_IFHEAD
102 # 2.7-2.9
103 ifeq ($(shell uname -r | cut -c 1),2)
104 CFLAGS += -D AICCU_TYPE="\"openbsd2\""
105 SRCS += ../common/aiccu_openbsd2.c
106 OBJS += ../common/aiccu_openbsd2.o
107 else
108 # 3.x-4.x etc
109 CFLAGS += -D AICCU_TYPE="\"openbsd\""
110 SRCS += ../common/aiccu_openbsd.c
111 OBJS += ../common/aiccu_openbsd.o
112 endif
113 CFLAGS += -pthread
114 endif
116 # Darwin
117 ifeq ($(shell uname | grep -c "Darwin"),1)
118 CFLAGS += -D_DARWIN -D NEED_IFHEAD -D AICCU_TYPE="\"darwin\""
119 SRCS += ../common/aiccu_darwin.c
120 OBJS += ../common/aiccu_darwin.o
121 LDFLAGS += -lresolv
122 endif
124 # SunOS / Solaris
125 ifeq ($(shell uname | grep -c "SunOS"),1)
126 CFLAGS += -D_SUNOS -D AICCU_TYPE="\"sunos\""
127 SRCS += ../common/aiccu_sunos.c
128 OBJS += ../common/aiccu_sunos.o
129 LDFLAGS += -lsocket -lnsl -lresolv
130 endif
132 # AIX
133 ifeq ($(shell uname | grep -c "AIX"),1)
134 CC = @/usr/vac/bin/xlc_r
135 CFLAGS = -qthreaded -q64 -qlanglvl=stdc99 -bmaxdata:0xD0000000 -D_64BIT -g -qdbxextra -qfullpath -qheapdebug -qformat=all -qcheck=all
136 CFLAGS += -D AICCU_CONSOLE
137 CFLAGS += -D_AIX -D AICCU_TYPE="\"aix\""
138 SRCS += ../common/aiccu_aix.c
139 OBJS += ../common/aiccu_aix.o
140 LDFLAGS += -lpthread
141 endif
144 all: aiccu
146 aiccu: $(OBJS) ${SRCS} ${INCS}
147 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS)
148 ifeq ($(shell echo $(CFLAGS) | grep -c "DEBUG"),0)
149 ifeq ($(shell echo "$(RPM_OPT_FLAGS)" | wc -c),1)
150 strip $@
151 endif
152 endif
154 clean:
155 $(RM) -f $(OBJS) aiccu
157 install: aiccu
158 cp aiccu ${DESTDIR}${dirsbin}aiccu