X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/102ad2157b31642e029c8c176de1cc5b22c96599..d5434378fcb343964a8f803a53054c2ad1241b2e:/package/nvram/src/Makefile diff --git a/package/nvram/src/Makefile b/package/nvram/src/Makefile index 376c2b7de..4872728ba 100644 --- a/package/nvram/src/Makefile +++ b/package/nvram/src/Makefile @@ -1,22 +1,33 @@ -# $Id$ +CLI_FILENAME = nvram -EXTRA_CFLAGS := -c -I. -I../include -LIBSHARED_OBJS := shutils.o wl.o wl_linux.o defaults.o linux_timer.o -LIBNVRAM_OBJS := nvram_linux.o nvram_convert.o +LIB_VERMAJOR = 0 +LIB_VERMINOR = 1 +LIB_FILENAME = libnvram.so -all: libshared.so libnvram.so nvram +LIB_CFLAGS = $(CFLAGS) -shared -fPIC +LIB_LDFLAGS = $(LDFLAGS) -Wl,-soname,$(LIB_FILENAME).$(LIB_VERMAJOR).$(LIB_VERMINOR) -%.o: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $^ +CLI_CFLAGS = $(CFLAGS) +CLI_LDFLAGS = $(LDFLAGS) -libshared.so: $(LIBSHARED_OBJS) - $(CC) -shared -o $@ $^ +CLI_OBJ = cli.o +LIB_OBJ = crc.o nvram.o -libnvram.so: $(LIBNVRAM_OBJS) - $(CC) -shared -o $@ $^ +all: cli libnvram -nvram: main.o - $(CC) -o $@ $^ -L. -lnvram +cli: libnvram + $(CC) $(CLI_CFLAGS) -c -o cli.o cli.c + $(CC) -o $(CLI_FILENAME) $(CLI_LDFLAGS) $(CLI_OBJ) \ + $(LIB_FILENAME).$(LIB_VERMAJOR).$(LIB_VERMINOR) + +cli.o: cli.c + $(CC) $(CLI_CFLAGS) -c -o $@ $< + +libnvram: + $(CC) $(LIB_CFLAGS) -c -o crc.o crc.c + $(CC) $(LIB_CFLAGS) -c -o nvram.o nvram.c + $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) \ + -o $(LIB_FILENAME).$(LIB_VERMAJOR).$(LIB_VERMINOR) $(LIB_OBJ) clean: - rm -f *.o *.so nvram + rm -f $(CLI_FILENAME) $(LIB_FILENAME)* *.o