Commit f1f9fbbe authored by chenhaowen's avatar chenhaowen

fix: Makefile detect OS error.

parent 5f4fb1f4
#CC:=gcc
VERSION:=1.6.6
VERSION:=1.6.7
CFLAGS+= -Wall -fPIC -DDEBUG -DVERSION=\"$(VERSION)\"
objects= config.o auth.o
all: gdut-drcom
@echo gdut-drcom
# detect OS
ifeq ($(OS), Windows_NT)
# windows
LIBS+= -lws2_32
CFLAGS+= -DWIN32
#CFLAGS+=-m32
DLLNAME=gdut-drcom.dll.$(VERSION)
RM=del
else
# unix like
DLLNAME=gdut-drcom.so.$(VERSION)
RM=rm -f
endif
# crypto lib
ifeq ($(cryptlib), polarssl)
CFLAGS+=-D__WITH_POLARSSL__
LIBS:=-lpolarssl
LIBS+=-lpolarssl
else ifeq ($(cryptlib), gcrypt)
CFLAGS+=-D__WITH_GCRYPT__
LIBS:=-lgcrypt
LIBS+=-lgcrypt
else ifeq ($(cryptlib), openssl)
CFLAGS+=-D__WITH_OPENSSL__
LIBS:=-lcrypto
LIBS+=-lcrypto
else
# default
objects+= md5.o md4.o sha1.o
endif
ifeq ($(LANG),)
LIBS+= -lws2_32
#CFLAGS+=-m32
DLLNAME=gdut-drcom.dll.$(VERSION)
else
DLLNAME=gdut-drcom.so.$(VERSION)
endif
all: gdut-drcom
@echo gdut-drcom
gdut-drcom: $(objects) gdut-drcom.o
$(CC) *.o -o gdut-drcom $(CFLAGS) $(LIBS)
dll: $(objects)
@echo gdut-drcom shared library
$(CC) -shared $(objects) -o $(DLLNAME) $(CFLAGS) $(LIBS)
gdut-drcom.o: gdut-drcom.c
......@@ -47,8 +57,4 @@ md5.o md4.o sha1.o:
.PHONY : clean
clean:
ifeq ($(LANG),)
del gdut-drcom.exe *.o *.dll.$(VERSION)
else
$(RM) gdut-drcom *.o *.so.$(VERSION)
endif
$(RM) gdut-drcom $(DLLNAME) *.o
......@@ -324,6 +324,7 @@ HEART_BEAT_START:
int exit_auth(void)
{
fprintf(drcom_config.log_file, "gdut-drcom heart-beat exiting!\r\n");
fclose(drcom_config.log_file);
drcom_config.exit = 1;
return 0;
}
......
......@@ -119,5 +119,6 @@ static void print_help(char *name)
fprintf(stdout, " [-c, --config-file <file>] The path to config file.\n");
fprintf(stdout, " [-l, --log-file <file>] The path to log file, default as stdout.\n");
fprintf(stdout, " [-h, --help] Print this message.\n");
fprintf(stdout, " [-v, --version] Print version infomatuon..\n");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment