]> git.ipfire.org Git - people/stevee/aiccu.git/blame - unix-console/Makefile
no quiet gcc
[people/stevee/aiccu.git] / unix-console / Makefile
CommitLineData
d98f6a46
SS
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# **********************************************************/
12
13SRCS = 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
14INCS = ../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
15OBJS = 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
16
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
22
23# Our very *bliep* set of options to make sure that these things can't cause any issues
24CWARNS += -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
26
27#CFLAGS += $(CWARNS) -D_GNU_SOURCE -D_DEBUG -g3 -O0
28CFLAGS += $(CWARNS) -D_GNU_SOURCE
b0998999 29CC = gcc
d98f6a46
SS
30RM = rm
31
32# Add -O3 when nothing is specified yet
33ifeq ($(shell echo $(CFLAGS) | grep -c "\-O"),0)
34CFLAGS += -O3
35endif
36
37# This is a console client
38CFLAGS += -D AICCU_CONSOLE
39
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
43ifeq ($(shell uname | grep -c "Linux"),1)
44CFLAGS += -D AICCU_GNUTLS
45LDFLAGS += -lgnutls
46endif
47
48# Linux
49ifeq ($(shell uname | grep -c "Linux"),1)
50CFLAGS += -D_LINUX -D HAS_IFHEAD -D AICCU_TYPE="\"linux\""
51SRCS += ../common/aiccu_linux.c
52OBJS += ../common/aiccu_linux.o
53LDFLAGS += -lpthread -lresolv
54endif
55
56# FreeBSD
57ifeq ($(shell uname | grep -c "FreeBSD"),1)
58CFLAGS += -D_FREEBSD
59
60# FreeBSD 4.x
61ifeq ($(shell uname -r | cut -c 1),4)
62CFLAGS += -D AICCU_TYPE="\"freebsd4\""
63SRCS += ../common/aiccu_freebsd4.c
64OBJS += ../common/aiccu_freebsd4.o
65else
66# FreeBSD 5.x/6.x/7.x
67CFLAGS += -D NEED_IFHEAD -D AICCU_TYPE="\"kame\""
68SRCS += ../common/aiccu_kame.c
69OBJS += ../common/aiccu_kame.o
70endif
71endif
72
73# DragonFlyBSD
74ifeq ($(shell uname | grep -c "DragonFly"),1)
75CFLAGS += -D_DFBSD -D NEED_IFHEAD -D AICCU_TYPE="\"dragonfly\""
76SRCS += ../common/aiccu_freebsd4.c
77OBJS += ../common/aiccu_freebsd4.o
78CFLAGS += -pthread
79endif
80
81# NetBSD
82ifeq ($(shell uname | grep -c "NetBSD"),1)
83CFLAGS += -D_NETBSD -D AICCU_TYPE="\"kame\""
84
85# Check if net/if_tun.h has TUNSIFHEAD and enable support for it
86ifneq ($(shell grep -c TUNSIFHEAD /usr/include/net/if_tun.h 2>/dev/null),1)
87# Supports TUNSIFHEAD -> AYIYA/l2tp available
88CFLAGS += -D NEED_IFHEAD
89else
90# Doesn't support TUNSIFHEAD -> No AYIYA/l2tp available
91CFLAGS += -D NO_IFHEAD
92endif
93
94SRCS += ../common/aiccu_kame.c
95OBJS += ../common/aiccu_kame.o
96CFLAGS += -pthread -D_NETBSD_SOURCE
97endif
98
99# OpenBSD
100ifeq ($(shell uname | grep -c "OpenBSD"),1)
101CFLAGS += -D_OPENBSD -D HAS_IFHEAD
102# 2.7-2.9
103ifeq ($(shell uname -r | cut -c 1),2)
104CFLAGS += -D AICCU_TYPE="\"openbsd2\""
105SRCS += ../common/aiccu_openbsd2.c
106OBJS += ../common/aiccu_openbsd2.o
107else
108# 3.x-4.x etc
109CFLAGS += -D AICCU_TYPE="\"openbsd\""
110SRCS += ../common/aiccu_openbsd.c
111OBJS += ../common/aiccu_openbsd.o
112endif
113CFLAGS += -pthread
114endif
115
116# Darwin
117ifeq ($(shell uname | grep -c "Darwin"),1)
118CFLAGS += -D_DARWIN -D NEED_IFHEAD -D AICCU_TYPE="\"darwin\""
119SRCS += ../common/aiccu_darwin.c
120OBJS += ../common/aiccu_darwin.o
121LDFLAGS += -lresolv
122endif
123
124# SunOS / Solaris
125ifeq ($(shell uname | grep -c "SunOS"),1)
126CFLAGS += -D_SUNOS -D AICCU_TYPE="\"sunos\""
127SRCS += ../common/aiccu_sunos.c
128OBJS += ../common/aiccu_sunos.o
129LDFLAGS += -lsocket -lnsl -lresolv
130endif
131
132# AIX
133ifeq ($(shell uname | grep -c "AIX"),1)
134CC = @/usr/vac/bin/xlc_r
135CFLAGS = -qthreaded -q64 -qlanglvl=stdc99 -bmaxdata:0xD0000000 -D_64BIT -g -qdbxextra -qfullpath -qheapdebug -qformat=all -qcheck=all
136CFLAGS += -D AICCU_CONSOLE
137CFLAGS += -D_AIX -D AICCU_TYPE="\"aix\""
138SRCS += ../common/aiccu_aix.c
139OBJS += ../common/aiccu_aix.o
140LDFLAGS += -lpthread
141endif
142
143
144all: aiccu
145
146aiccu: $(OBJS) ${SRCS} ${INCS}
431ff599 147 $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
d98f6a46
SS
148
149clean:
150 $(RM) -f $(OBJS) aiccu
151
152install: aiccu
153 cp aiccu ${DESTDIR}${dirsbin}aiccu
154