1# @(#) gcc makefile for udpxy project 2# 3# Copyright 2008 Pavel V. Cherenkov 4# 5# This file is part of udpxy. 6# 7# udpxy is free software: you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation, either version 3 of the License, or 10# (at your option) any later version. 11# 12# udpxy is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with udpxy. If not, see <http://www.gnu.org/licenses/>. 19# 20 21.SUFFIXES : .o .c .d 22 23EXEC = udpxy 24UPXC = upxc 25CC = gcc 26CFLAGS = -W -Wall -Werror --pedantic 27 28BUILDFILE = BUILD 29BUILDNO = `cat $(BUILDFILE)` 30 31VERSIONFILE = VERSION 32VERSION = `cat $(VERSIONFILE) | tr -d '"'` 33 34CHANGEFILE = CHANGES 35READMEFILE = README 36 37ARCDIR = .. 38ARCFILE = $(ARCDIR)/$(EXEC).$(VERSION)-$(BUILDNO).tgz 39WL_ARCFILE = $(ARCDIR)/$(EXEC).wl.$(VERSION)-$(BUILDNO).tgz 40 41COMMON_OPT = 42DEBUG_OPT = $(COMMON_OPT) -g -DTRACE_MODULE 43PROD_OPT = $(COMMON_OPT) -DNDEBUG -DTRACE_MODULE 44LEAN_OPT = -DNDEBUG 45 46MKDEPOPT = -M 47 48SRC = udpxy.c rparse.c util.c prbuf.c ifaddr.c ctx.c mkpg.c \ 49 rtp.c uopt.c dpkt.c netop.c extrn.c udpxrec.c main.c 50OBJ = ${SRC:.c=.o} 51DEP = ${SRC:.c=.d} 52 53UPXC_SRC = upxc.c util.c rtp.c dpkt.c extrn.c 54UPXC_OBJ = ${UPXC_SRC:.c=.o} 55UPXC_DEP = upxc.dep 56 57WLDIR = udpxy-wl 58 59CORES = core.* core 60 61.c.d : 62 $(CC) $(CFLAGS) $(MKDEPOPT) $< -o $@ 63 64.c.o : 65 $(CC) $(CFLAGS) $(CDEFS) $(COPT) -c $< -o $@ 66 67release: 68 @echo -e "\nMaking a [release] version (use 'debug' target as an alternative)\n" 69 @make all "COPT=${PROD_OPT}" 70 @strip $(EXEC) 71 72debug: 73 @echo -e "\nMaking a [debug] version (use 'release' target as an alternative)\n" 74 @make all "COPT=${DEBUG_OPT}" 75 76lean: 77 @echo -e "\nMaking a [lean] version (minimal size)\n" 78 @make all "COPT=${LEAN_OPT}" 79 @strip $(EXEC) 80 81verify: 82 @echo -e "\nVerifying all build targets\n" 83 @make clean 84 @make lean 85 @make clean 86 @make release 87 @make clean 88 @make debug 89 make clean 90 91all: $(DEP) $(UPXC_DEP) $(EXEC) 92# include $(UPXC) (if needed) in all target to build 93 94deps: 95 $(CC) $(CFLAGS) $(MKDEPOPT) $(SRC) 96 97-include $(DEP) $(UPXC_DEP) 98 99$(DEP): $(SRC) 100$(UPXC_DEP) : $(UPXC_SRC) 101 102$(EXEC) : $(OBJ) 103 @rm -f $(EXEC) 104 $(CC) $(CFLAGS) $(COPT) -o $(EXEC) $(OBJ) 105 @ls -l $(EXEC) 106 107$(UPXC) : $(UPXC_OBJ) 108 rm -f $(UPXC) 109 $(CC) $(CFLAGS) $(COPT) -o $(UPXC) $(UPXC_OBJ) 110 ls -l $(UPXC) 111 112strip: 113 @echo "Stripping $(EXEC)" 114 @strip $(EXEC) $(UPXC) 115 @ls -l $(EXEC) $(UPXC) 116 117touch: 118 touch $(SRC) $(UPXC_SRC) 119 120clean: 121 rm -f $(CORES) $(DEP) $(OBJ) $(UPXC_DEP) $(UPXC_OBJ) $(EXEC) $(UPXC) 122 123incbuild: 124 @expr `cat $(BUILDFILE)` + 1 > $(BUILDFILE) 125 @echo "Set build number to: `cat $(BUILDFILE)`" 126 @make touch 127 128tar: 129 tar -cvzf $(ARCFILE) $(SRC) *.h *.mk *.txt \ 130 $(BUILDFILE) $(VERSIONFILE) $(CHANGEFILE) $(READMEFILE) 131 @ls -l $(ARCFILE) 132 133wl-distro: 134 rm -fr $(WLDIR) 135 mkdir $(WLDIR) 136 cp $(SRC) $(UPXC_SRC) *.h gpl.txt \ 137 $(BUILDFILE) $(VERSIONFILE) $(CHANGEFILE) $(READMEFILE) $(WLDIR) 138 cp wl500-gcc.mk $(WLDIR)/makefile 139 tar -cvzf $(WL_ARCFILE) $(WLDIR)/* 140 @ls -l $(WL_ARCFILE) 141 rm -fr $(WLDIR) 142 143# __EOF__ 144 145