Skip to content

Commit

Permalink
Add static lib target (#374)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #374

Previous changes to conda build caused build breakages due to fbclock.so not being copied correctly. One of the suggestions was to make it static lib that further links to libnccl. So that all the upper layers only have to worry about managing libnccl.so, as they already do and not concern with managing other dependent libs.

In this take2, introduce static lib target for fbclock, that will be further be linked to libnccl.so in subsequent changes.

Reviewed By: leoleovich

Differential Revision: D58930591

fbshipit-source-id: c6bbaa6e1e6c050b302b11b3a7d682e799d049b9
  • Loading branch information
deepshah133 authored and facebook-github-bot committed Jun 24, 2024
1 parent 4db09ad commit b656f6a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fbclock/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ CC=gcc
CFLAGS=-Wall -g -lrt -msse4.2 -std=gnu11
CPP=g++
CPPFLAGS=-fpermissive -lrt -lpthread -msse4.2 -lgtest -g
AR=ar
ARFLAGS=rcs

.PHONY: clean test

Expand All @@ -11,6 +13,11 @@ fbclock:
mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) -shared -o $(BUILDDIR)/fbclock.so -fPIC fbclock.c

fbclock-static:
mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) -c -fPIC -o $(BUILDDIR)/fbclock.o fbclock.c
$(AR) $(ARFLAGS) $(BUILDDIR)/libfbclock.a $(BUILDDIR)/fbclock.o

test:
$(CPP) $(CPPFLAGS) -o fbclock-test test/test.cpp fbclock.c
./fbclock-test
Expand Down

0 comments on commit b656f6a

Please sign in to comment.