Commit f1f9fbbe authored by chenhaowen's avatar chenhaowen

fix: Makefile detect OS error.

parent 5f4fb1f4
#CC:=gcc #CC:=gcc
VERSION:=1.6.6 VERSION:=1.6.7
CFLAGS+= -Wall -fPIC -DDEBUG -DVERSION=\"$(VERSION)\" CFLAGS+= -Wall -fPIC -DDEBUG -DVERSION=\"$(VERSION)\"
objects= config.o auth.o objects= config.o auth.o
all: gdut-drcom # detect OS
@echo gdut-drcom 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) ifeq ($(cryptlib), polarssl)
CFLAGS+=-D__WITH_POLARSSL__ CFLAGS+=-D__WITH_POLARSSL__
LIBS:=-lpolarssl LIBS+=-lpolarssl
else ifeq ($(cryptlib), gcrypt) else ifeq ($(cryptlib), gcrypt)
CFLAGS+=-D__WITH_GCRYPT__ CFLAGS+=-D__WITH_GCRYPT__
LIBS:=-lgcrypt LIBS+=-lgcrypt
else ifeq ($(cryptlib), openssl) else ifeq ($(cryptlib), openssl)
CFLAGS+=-D__WITH_OPENSSL__ CFLAGS+=-D__WITH_OPENSSL__
LIBS:=-lcrypto LIBS+=-lcrypto
else else
# default
objects+= md5.o md4.o sha1.o objects+= md5.o md4.o sha1.o
endif endif
ifeq ($(LANG),) all: gdut-drcom
LIBS+= -lws2_32 @echo gdut-drcom
#CFLAGS+=-m32
DLLNAME=gdut-drcom.dll.$(VERSION)
else
DLLNAME=gdut-drcom.so.$(VERSION)
endif
gdut-drcom: $(objects) gdut-drcom.o gdut-drcom: $(objects) gdut-drcom.o
$(CC) *.o -o gdut-drcom $(CFLAGS) $(LIBS) $(CC) *.o -o gdut-drcom $(CFLAGS) $(LIBS)
dll: $(objects) dll: $(objects)
@echo gdut-drcom shared library
$(CC) -shared $(objects) -o $(DLLNAME) $(CFLAGS) $(LIBS) $(CC) -shared $(objects) -o $(DLLNAME) $(CFLAGS) $(LIBS)
gdut-drcom.o: gdut-drcom.c gdut-drcom.o: gdut-drcom.c
...@@ -47,8 +57,4 @@ md5.o md4.o sha1.o: ...@@ -47,8 +57,4 @@ md5.o md4.o sha1.o:
.PHONY : clean .PHONY : clean
clean: clean:
ifeq ($(LANG),) $(RM) gdut-drcom $(DLLNAME) *.o
del gdut-drcom.exe *.o *.dll.$(VERSION)
else
$(RM) gdut-drcom *.o *.so.$(VERSION)
endif
...@@ -324,6 +324,7 @@ HEART_BEAT_START: ...@@ -324,6 +324,7 @@ HEART_BEAT_START:
int exit_auth(void) int exit_auth(void)
{ {
fprintf(drcom_config.log_file, "gdut-drcom heart-beat exiting!\r\n"); fprintf(drcom_config.log_file, "gdut-drcom heart-beat exiting!\r\n");
fclose(drcom_config.log_file);
drcom_config.exit = 1; drcom_config.exit = 1;
return 0; return 0;
} }
......
...@@ -119,5 +119,6 @@ static void print_help(char *name) ...@@ -119,5 +119,6 @@ static void print_help(char *name)
fprintf(stdout, " [-c, --config-file <file>] The path to config file.\n"); 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, " [-l, --log-file <file>] The path to log file, default as stdout.\n");
fprintf(stdout, " [-h, --help] Print this message.\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