Debian Codegraph @

transport-native-unix-common/Makefile

raw symbols SCIP
1 # Copyright 2016 The Netty Project
2 #
3 # The Netty Project licenses this file to you under the Apache License,
4 # version 2.0 (the "License"); you may not use this file except in compliance
5 # with the License. You may obtain a copy of the License at:
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 ## GNU Makefile designed to build a static library which can be shared across multiple architectures.
16
17 ## Input environment:
18 # CC - compiler (gcc or clang)
19 # AR - archiver (ar)
20 # JNI_PLATFORM - "linux" for linux and "darwin" for mac.
21 # LIB_DIR - where the static library will be built in
22 # OBJ_DIR - where the obj files will be built in (defaults to LIB_DIR)
23 # LIB_NAME - the name of the native library
24
25 SRC_DIR = src/main/c
26 JNI_INCLUDE_DIR = $(JAVA_HOME)/include
27 JNI_INCLUDES = -I$(JNI_INCLUDE_DIR) -I$(JNI_INCLUDE_DIR)/$(JNI_PLATFORM)
28 LIB = $(LIB_DIR)/$(LIB_NAME).a
29
30 CFLAGS += $(JNI_INCLUDES)
31
32 SRCS = $(wildcard $(SRC_DIR)/*.c)
33 OBJS = $(SRCS:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
34
35 all: $(LIB)
36
37 $(LIB): $(OBJS)
38 mkdir -p $(LIB_DIR)
39 $(AR) rcs $(LIB) $^
40
41 $(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
42 mkdir -p $(OBJ_DIR)
43 $(CC) -o $@ -c $< $(CFLAGS)
44
45 clean:
46 rm -rf $(LIB_DIR) $(OBJ_DIR)
47
48 ## Debug support
49 # use make print-VARIABLE name to see the value
50 print-% : ; @echo $* = $($*)