Skip to content

Commit

Permalink
Makefile: Changes to make jclklib available from libptpmgmt
Browse files Browse the repository at this point in the history
Signed-off-by: Noor Azura Ahmad Tarmizi <[email protected]>
  • Loading branch information
AzuraTarmiziIntel authored and yoongsiang2 committed May 22, 2024
1 parent b500ac5 commit 342010a
Show file tree
Hide file tree
Showing 4 changed files with 327 additions and 15 deletions.
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ PUB:=pub
PUB_C:=$(PUB)/c
PMC_DIR:=ptp-tools
JSON_SRC:=json
JCLKLIB_SRC:=jclklib
OBJ_DIR:=objs

CONF_FILES:=configure src/config.h.in
Expand Down Expand Up @@ -225,11 +226,16 @@ HEADERS_INST:=$(HEADERS_PUB) $(HEADERS_GEN_PUB)
HEADERS_INST_C:=$(HEADERS_PUB_C) $(HEADERS_GEN_PUB_C)
SRCS:=$(wildcard $(SRC)/*.cpp)
SRCS_JSON:=$(wildcard $(JSON_SRC)/*.cpp)
SRCS_JCLKLIB:=$(wildcard $(JCLKLIB_SRC)/*.cpp)
COMP_DEPS:=$(OBJ_DIR) $(HEADERS_GEN_COMP)
# json-c
JSONC_LIB:=$(LIB_NAME)_jsonc.so
JSONC_LIBA:=$(LIB_NAME)_jsonc.a
JSONC_FLIB:=$(JSONC_LIB)$(SONAME)
# jclklib
JCLKLIB_LIB:=jclklib.so
#JSONC_LIBA:=$(LIB_NAME)_jsonc.a
JCLKLIB_FLIB:=$(JCLKLIB_LIB)$(SONAME)
# fastjson
FJSON_LIB:=$(LIB_NAME)_fastjson.so
FJSON_LIBA:=$(LIB_NAME)_fastjson.a
Expand Down Expand Up @@ -257,7 +263,9 @@ endif
SRC_FILES_DIR:=$(wildcard scripts/* *.md t*/*.pl */*/*.m4 .reuse/* */gitlab*\
*/github* */*.opt config.guess config.sub configure.ac install-sh */*.m4\
t*/*.sh */*/*.sh swig/*.md swig/*/* */*.i */*/msgCall.i */*/warn.i man/*\
$(PMC_DIR)/phc_ctl $(PMC_DIR)/*.[ch]* $(JSON_SRC)/* */Makefile w*/*/Makefile\
$(PMC_DIR)/phc_ctl $(PMC_DIR)/*.[ch]* $(JSON_SRC)/*\
$(JCLKLIB_SRC)/common/* $(JCLKLIB_SRC)/proxy/* $(JCLKLIB_SRC)/client/*\
*/Makefile w*/*/Makefile\
*/*/*test*/*.go LICENSES/* *.in tools/*.in) src/ver.h.in src/name.h.in\
$(SRCS) $(HEADERS_SRCS) LICENSE $(MAKEFILE_LIST) credits
ifeq ($(INSIDE_GIT),true)
Expand Down Expand Up @@ -392,6 +400,7 @@ endif # VALGRIND

# JSON libraries
include $(JSON_SRC)/Makefile
include $(JCLKLIB_SRC)/Makefile

# Compile library source code
$(LIB_OBJS): $(OBJ_DIR)/%.o: $(SRC)/%.cpp | $(COMP_DEPS)
Expand Down Expand Up @@ -444,7 +453,7 @@ CPPCHECK_OPT+=--suppress=preprocessorErrorDirective
EXTRA_C_SRCS:=$(wildcard uctest/*.c)
EXTRA_SRCS:=$(wildcard $(foreach n,sample utest uctest,$n/*.cpp $n/*.h))
EXTRA_SRCS+=$(EXTRA_C_SRCS)
format: $(HEADERS_GEN) $(HEADERS_SRCS) $(SRCS) $(EXTRA_SRCS) $(SRCS_JSON)
format: $(HEADERS_GEN) $(HEADERS_SRCS) $(SRCS) $(EXTRA_SRCS) $(SRCS_JSON) $(SRCS_JCLKLIB)
$(Q_FRMT)
r=`$(ASTYLE) --project=none --options=tools/astyle.opt $^`
test -z "$$r" || echo "$$r";./tools/format.pl $^
Expand Down Expand Up @@ -554,13 +563,13 @@ checkall: format doxygen

ifneq ($(CTAGS),)
tags: $(filter-out $(SRC)/ids.h,$(HEADERS_GEN_COMP)) $(HEADERS_SRCS) $(SRCS)\
$(SRCS_JSON)
$(SRCS_JSON) $(SRCS_JCLKLIB)
$(Q_TAGS)$(CTAGS) -R $^
ALL+=tags
endif # CTAGS

.DEFAULT_GOAL=all
all: $(COMP_DEPS) $(ALL)
all: $(COMP_DEPS) $(ALL) jclklib
$(NOP)

####### installation #######
Expand Down Expand Up @@ -751,7 +760,7 @@ DISTCLEAN:=$(addprefix config.,log status) configure configure~ defs.mk\
$(wildcard src/config.h*)
DISTCLEAN_DIRS:=autom4te.cache

clean: deb_clean
clean: deb_clean jclklib_clean
$(Q_CLEAN)$(RM) $(CLEAN)
$(RM) -R $(CLEAN_DIRS)
distclean: deb_clean
Expand Down
26 changes: 16 additions & 10 deletions jclklib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@

CWD := $(shell pwd)

.PHONY: all
all:
$(MAKE) -C $(CWD)/common default
$(MAKE) -C $(CWD)/proxy default
$(MAKE) -C $(CWD)/client default
.PHONY: jclklib
jclklib:
$(MAKE) -C $(CWD)/jclklib/common default
$(MAKE) -C $(CWD)/jclklib/proxy default
$(MAKE) -C $(CWD)/jclklib/client default
# $(MAKE) -C $(CWD)/jclklib/test default

.PHONY: clean
clean:
$(MAKE) -C $(CWD)/client clean
$(MAKE) -C $(CWD)/proxy clean
$(MAKE) -C $(CWD)/common clean
.PHONY: jclklib_test
jclklib_test:
$(MAKE) -C $(CWD)/jclklib/test default

.PHONY: jclklib_clean
jclklib_clean:
$(MAKE) -C $(CWD)/jclklib/client clean
$(MAKE) -C $(CWD)/jclklib/proxy clean
$(MAKE) -C $(CWD)/jclklib/common clean
# $(MAKE) -C $(CWD)/jclklib/test clean
28 changes: 28 additions & 0 deletions jclklib/test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# SPDX-License-Identifier: LGPL-3.0-or-later
# SPDX-FileCopyrightText: Copyright © 2024 Intel Corporation. All rights reserved.
#
# Makefile for jclklib client
#
# @author Christopher Hall <[email protected]>
# @copyright © 2024 Intel Corporation. All rights reserved.
# @license LGPL-3.0-or-later
#
###############################################################################


JCLKLIB_CLIENT_DIR := $(shell pwd)/../client
JCLKLIB_TOPLEVEL_DIR = $(JCLKLIB_CLIENT_DIR)/..
JCLKLIB_COMMON_DIR = $(JCLKLIB_TOPLEVEL_DIR)/common

default: test

#.PHONY: build-all
#build-all: test
# echo "Running" $@
# $(MAKE) -C $(JCLKLIB_CLIENT_DIR) $(REAL_TARGETS)
test: test.o jclklib.so
g++ -o test test.o -L $(JCLKLIB_CLIENT_DIR) -I $(JCLKLIB_CLIENT_DIR)/.. -l:jclklib.so

#%.o : %.cpp
# echo "[COMPILE]" $<
# g++ -c $< -I $(JCLKLIB_TOPLEVEL_DIR) -fPIC -fdiagnostics-color=always
Loading

0 comments on commit 342010a

Please sign in to comment.