🔧 build: 修改 makefile
parent
3818bdcad8
commit
841999c589
@ -1,19 +0,0 @@
|
||||
Copyright (C) 2010-2013 nsf <no.smile.face@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@ -1,2 +0,0 @@
|
||||
*.o
|
||||
*.so
|
||||
@ -1,26 +1,30 @@
|
||||
PROJECT = rc4
|
||||
SRC = .
|
||||
INC = -I. -I/usr/local/include
|
||||
|
||||
CC = gcc
|
||||
CC_FLAGS = -O2 -fPIC $(INC) -Wall -Wextra -c
|
||||
SKYNET_ROOT ?= ../../skynet
|
||||
include $(SKYNET_ROOT)/platform.mk
|
||||
|
||||
SRC_C = $(foreach dir, $(SRC), $(wildcard $(dir)/*.c))
|
||||
OBJ_C = $(patsubst %.c, %.o, $(SRC_C))
|
||||
OBJ = $(OBJ_C)
|
||||
PLAT ?= none
|
||||
|
||||
.PHONY : all
|
||||
all: $(PROJECT).so
|
||||
TARGET = ../../luaclib/rc4.so
|
||||
|
||||
$(PROJECT).so: $(OBJ)
|
||||
ld -shared $(OBJ) -o $(PROJECT).so
|
||||
ifdef OUTPUT
|
||||
cp -f $(PROJECT).so $(OUTPUT)
|
||||
ifeq ($(PLAT), macosx)
|
||||
CFLAGS = -g -O2 -dynamiclib -Wl,-undefined,dynamic_lookup
|
||||
else
|
||||
ifeq ($(PLAT), linux)
|
||||
CFLAGS = -g -O2 -shared -fPIC
|
||||
endif
|
||||
endif
|
||||
|
||||
LUA_LIB ?= $(SKYNET_ROOT)/3rd/lua/
|
||||
LUA_INC ?= $(SKYNET_ROOT)/3rd/lua/
|
||||
SKYNET_SRC ?= $(SKYNET_ROOT)/skynet-src
|
||||
|
||||
SRC = .
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(OBJ_C) : %.o : %.c
|
||||
$(CC) $(CC_FLAGS) -o $@ $<
|
||||
$(TARGET): $(foreach dir, $(SRC), $(wildcard $(dir)/*.c))
|
||||
$(CC) $(CFLAGS) $(SHARED) -I$(LUA_INC) -I$(SKYNET_SRC) $^ -o $@
|
||||
|
||||
.PHONY : clean
|
||||
clean:
|
||||
rm -f $(PROJECT).so $(OBJ)
|
||||
rm -f *.o $(TARGET)
|
||||
Loading…
Reference in New Issue