Add build target for libmousefs_client.a static library
- Add CLIENT_CFILES and CLIENT_OFILES variables to Makefile - Add rules to build object files and create static library - Include libmousefs_client.a in the 'all' target - Update clean target to remove library and object files - Update .gitignore to ignore *.o and *.a build artifacts The library includes: client.c, basic.c, tcp.c, message.c
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
chunk_server_data_*
|
chunk_server_data_*
|
||||||
|
|||||||
@@ -12,9 +12,13 @@ endif
|
|||||||
CFILES = $(shell find src -name '*.c')
|
CFILES = $(shell find src -name '*.c')
|
||||||
HFILES = $(shell find src -name '*.h')
|
HFILES = $(shell find src -name '*.h')
|
||||||
|
|
||||||
|
# Client library source files
|
||||||
|
CLIENT_CFILES = src/client.c src/basic.c src/tcp.c src/message.c
|
||||||
|
CLIENT_OFILES = $(CLIENT_CFILES:.c=.o)
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all: mousefs_server$(EXT) mousefs_test$(EXT) example_client$(EXT)
|
all: mousefs_server$(EXT) mousefs_test$(EXT) example_client$(EXT) libmousefs_client.a
|
||||||
|
|
||||||
mousefs_server$(EXT): $(CFILES) $(HFILES)
|
mousefs_server$(EXT): $(CFILES) $(HFILES)
|
||||||
gcc -o $@ $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc -DBUILD_SERVER
|
gcc -o $@ $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc -DBUILD_SERVER
|
||||||
@@ -25,11 +29,20 @@ mousefs_test$(EXT): $(CFILES) $(HFILES)
|
|||||||
example_client$(EXT): examples/main.c $(CFILES) $(HFILES)
|
example_client$(EXT): examples/main.c $(CFILES) $(HFILES)
|
||||||
gcc -o $@ examples/main.c $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc
|
gcc -o $@ examples/main.c $(CFILES) $(CFLAGS) $(LFLAGS) -Iinc
|
||||||
|
|
||||||
|
# Client library build rules
|
||||||
|
%.o: %.c $(HFILES)
|
||||||
|
gcc -c -o $@ $< $(CFLAGS) -Iinc
|
||||||
|
|
||||||
|
libmousefs_client.a: $(CLIENT_OFILES)
|
||||||
|
ar rcs $@ $^
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm \
|
rm -f \
|
||||||
mousefs_server.exe \
|
mousefs_server.exe \
|
||||||
mousefs_server.out \
|
mousefs_server.out \
|
||||||
mousefs_test.exe \
|
mousefs_test.exe \
|
||||||
mousefs_test.out \
|
mousefs_test.out \
|
||||||
example_client.exe \
|
example_client.exe \
|
||||||
example_client.out
|
example_client.out \
|
||||||
|
libmousefs_client.a \
|
||||||
|
$(CLIENT_OFILES)
|
||||||
|
|||||||
Reference in New Issue
Block a user