1C++ = g++ 2 3ifndef os 4 os = LINUX 5endif 6 7ifndef arch 8 arch = IA32 9endif 10 11CCFLAGS = -Wall -D$(os) -I../src -finline-functions -O3 12 13ifeq ($(arch), IA32) 14 CCFLAGS += -DIA32 #-mcpu=pentiumpro -march=pentiumpro -mmmx -msse 15endif 16 17ifeq ($(arch), POWERPC) 18 CCFLAGS += -mcpu=powerpc 19endif 20 21ifeq ($(arch), IA64) 22 CCFLAGS += -DIA64 23endif 24 25ifeq ($(arch), SPARC) 26 CCFLAGS += -DSPARC 27endif 28 29LDFLAGS = -L../src -ludt -lstdc++ -lpthread -lm 30 31ifeq ($(os), UNIX) 32 LDFLAGS += -lsocket 33endif 34 35ifeq ($(os), SUNOS) 36 LDFLAGS += -lrt -lsocket 37endif 38 39DIR = $(shell pwd) 40 41APP = appserver appclient sendfile recvfile test 42 43all: $(APP) 44 45%.o: %.cpp 46 $(C++) $(CCFLAGS) $< -c 47 48appserver: appserver.o 49 $(C++) $^ -o $@ $(LDFLAGS) 50appclient: appclient.o 51 $(C++) $^ -o $@ $(LDFLAGS) 52sendfile: sendfile.o 53 $(C++) $^ -o $@ $(LDFLAGS) 54recvfile: recvfile.o 55 $(C++) $^ -o $@ $(LDFLAGS) 56test: test.o 57 $(C++) $^ -o $@ $(LDFLAGS) 58 59clean: 60 rm -f *.o $(APP) 61 62install: 63 export PATH=$(DIR):$$PATH 64