SHELL = /bin/sh CC = g++ CC = gcc #CC = ${MY_ENV_CC} AR = ar ARFL = rv #ARFL = cru RANLIB = ranlib CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \ -Waggregate-return -Wno-long-long \ -Wpointer-arith -Werror -Wshadow -O2 \ -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO #CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align \ #-Waggregate-return -Wmissing-prototypes \ #-Wpointer-arith -Werror -Wshadow -O2 \ #-D_POSIX_PTHREAD_SEMANTICS -D_USE_FAST_MACRO ########################################################### #Check system: # Linux, SunOS, Solaris, BSD variants, AIX, HP-UX SYSLIB = -lpthread -lcrypt -lz CHECKSYSRES = @echo "Unknow system type!";exit 1 UNIXNAME = $(shell uname -sm) ifeq ($(CC),) CC = gcc endif #Path for Linux ifeq ($(findstring Linux, $(UNIXNAME)), Linux) ifeq ($CC, "gcc") CFLAGS += -Wstrict-prototypes endif CFLAGS += -DLINUX2 -D_REENTRANT -pedantic endif #Path for SunOS ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS) ifeq ($(findstring 86, $(UNIXNAME)), 86) SYSLIB += -lsocket -lnsl -lrt endif ifeq ($(findstring sun4u, $(UNIXNAME)), sun4u) SYSLIB += -lsocket -lnsl -lrt endif ifeq ($CC, "gcc") CFLAGS += -Wstrict-prototypes endif CFLAGS += -DSUNOS5 -D_REENTRANT -pedantic endif #Path for HP-UX ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX) ifeq ($CC, "gcc") CFLAGS += -Wstrict-prototypes endif CFLAGS += -DHP_UX -DHPUX11 PLAT_NAME=hp-ux endif #Find system type. ifneq ($(SYSPATH),) CHECKSYSRES = @echo "System is $(shell uname -sm)" endif ########################################################### BASE_PATH = ../.. BASE_LIB_PATH = $(BASE_PATH)/lib/linux BASE_INC_PATH = $(BASE_PATH)/include ACL_INC = $(BASE_PATH)/include/acl P2P_INC = $(BASE_PATH)/include/p2p P2P_CHAT_INC = $(BASE_PATH)/include/p2p_chat CFLAGS += $(INC_COMPILE) INC_COMPILE = -I$(P2P_CHAT_INC) -I$(P2P_INC) -I$(ACL_INC) -I$(BASE_INC_PATH) -I./include LIB_COMPILE = -L$(BASE_LIB_PATH) -l_chat -l_acl ########################################################### OUT_PATH = . OBJ_PATH = $(OUT_PATH)/debug #Project's objs SRC = $(wildcard src/*.c) $(wildcard win32/*.c) OBJ = $(patsubst %.c, $(OBJ_PATH)/%.o, $(notdir $(SRC))) ########################################################### PROG = regsvr_test .PHONY = all clean COMPILE = $(CC) $(CFLAGS) $(PROG): $(OBJ) $(CC) $(OBJ) $(LIB_COMPILE) $(SYSLIB) -o $(OBJ_PATH)/$(PROG) @echo "" @echo "All ok! Output:$(PROG)" @echo "" $(OBJ_PATH)/%.o: src/%.c $(COMPILE) $< -o $@ $(OBJ_PATH)/%.o: win32/%.c $(COMPILE) $< -o $@ clean: rm -f $(OBJ_PATH)/$(PROG) rm -f $(OBJ)