Jan Breuer
2015-04-19 6e73d8531ba409e513c2d491d473a7b593614733
Remove generationg .so and update makefiles

Update makefiles and resolve some gcc warnings on different targets

Conflicts:
Makefile
examples/common/scpi-def.c
libscpi/Makefile
12个文件已修改
75 ■■■■ 已修改文件
Makefile 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/Makefile 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/common/scpi-def.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-interactive/Makefile 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-interactive/main.c 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-parser/Makefile 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-parser/main.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-tcp-srq/Makefile 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-tcp-srq/main.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-tcp/Makefile 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/test-tcp/main.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
libscpi/Makefile 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Makefile
@@ -1,3 +1,5 @@
.PHONY: clean all test
all:
    $(MAKE) -C libscpi
    $(MAKE) -C examples
@@ -6,5 +8,5 @@
    $(MAKE) clean -C libscpi
    $(MAKE) clean -C examples
build-tests:
test:
    $(MAKE) test -C libscpi
examples/Makefile
@@ -1,10 +1,14 @@
.PHONY: clean all cli tcp
all:
all: cli tcp
cli:
    $(MAKE) -C test-interactive
    $(MAKE) -C test-parser
tcp:
    $(MAKE) -C test-tcp
    $(MAKE) -C test-tcp-srq
clean:
    $(MAKE) clean -C test-interactive
examples/common/scpi-def.c
@@ -149,7 +149,7 @@
    }
    
    SCPI_ChoiceToName(trigger_source, param, &name);
    fprintf(stderr, "\tP1=%s (%d)\r\n", name, param);
    fprintf(stderr, "\tP1=%s (%ld)\r\n", name, (long int)param);
    
    SCPI_ResultInt(context, param);
examples/test-interactive/Makefile
@@ -3,8 +3,9 @@
SRCS = main.c ../common/scpi-def.c
CFLAGS += -Wextra -I ../../libscpi/inc/
LDFLAGS += ../../libscpi/dist/libscpi.a
LDFLAGS += ../../libscpi/dist/libscpi.a -Wl,--as-needed
.PHONY: clean all
all: $(PROG)
@@ -14,7 +15,7 @@
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(PROG): $(OBJS)
    $(CC) -o $@ $(OBJS) $(LDFLAGS)
    $(CC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS)
clean:
    $(RM) $(PROG) $(OBJS)
examples/test-interactive/main.c
@@ -52,7 +52,7 @@
int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int16_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
@@ -87,7 +87,9 @@
    printf("SCPI Interactive demo\r\n");
    char smbuffer[10];
    while (1) {
         fgets(smbuffer, 10, stdin);
         if (NULL == fgets(smbuffer, 10, stdin)) {
             break;
         }
         SCPI_Input(&scpi_context, smbuffer, strlen(smbuffer));
    }
examples/test-parser/Makefile
@@ -3,8 +3,9 @@
SRCS = main.c ../common/scpi-def.c
CFLAGS += -Wextra -I ../../libscpi/inc/
LDFLAGS += ../../libscpi/dist/libscpi.a
LDFLAGS += ../../libscpi/dist/libscpi.a -Wl,--as-needed
.PHONY: clean all
all: $(PROG)
@@ -14,7 +15,7 @@
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(PROG): $(OBJS)
    $(CC) -o $@ $(OBJS) $(LDFLAGS)
    $(CC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS)
clean:
    $(RM) $(PROG) $(OBJS)
examples/test-parser/main.c
@@ -52,7 +52,7 @@
int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int16_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
examples/test-tcp-srq/Makefile
@@ -3,8 +3,9 @@
SRCS = main.c ../common/scpi-def.c
CFLAGS += -Wextra -I ../../libscpi/inc/
LDFLAGS += ../../libscpi/dist/libscpi.a
LDFLAGS += ../../libscpi/dist/libscpi.a -Wl,--as-needed
.PHONY: clean all
all: $(PROG)
@@ -14,7 +15,7 @@
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(PROG): $(OBJS)
    $(CC) -o $@ $(OBJS) $(LDFLAGS)
    $(CC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS)
clean:
    $(RM) $(PROG) $(OBJS)
examples/test-tcp-srq/main.c
@@ -84,7 +84,7 @@
int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    // BEEP
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int16_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
examples/test-tcp/Makefile
@@ -3,8 +3,9 @@
SRCS = main.c ../common/scpi-def.c
CFLAGS += -Wextra -I ../../libscpi/inc/
LDFLAGS += ../../libscpi/dist/libscpi.a
LDFLAGS += ../../libscpi/dist/libscpi.a -Wl,--as-needed
.PHONY: clean all
all: $(PROG)
@@ -14,7 +15,7 @@
    $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(PROG): $(OBJS)
    $(CC) -o $@ $(OBJS) $(LDFLAGS)
    $(CC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS)
clean:
    $(RM) $(PROG) $(OBJS)
examples/test-tcp/main.c
@@ -63,7 +63,7 @@
int SCPI_Error(scpi_t * context, int_fast16_t err) {
    (void) context;
    // BEEP
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int32_t) err, SCPI_ErrorTranslate(err));
    fprintf(stderr, "**ERROR: %d, \"%s\"\r\n", (int16_t) err, SCPI_ErrorTranslate(err));
    return 0;
}
libscpi/Makefile
@@ -1,23 +1,16 @@
VERSION = 2.0.0
LIBNAME = scpi
CFLAGS += -Wextra -g -fPIC -Iinc
CFLAGS += -Wextra -g -Iinc
LDFLAGS += -Wl,--as-needed
TESTFLAGS += -lcunit
TESTFLAGS += -lcunit $(CFLAGS)
OBJDIR=obj
DISTDIR=dist
TESTDIR=test
STATICLIB = lib$(LIBNAME).a
SHAREDLIB = lib$(LIBNAME).so
SHAREDLIBVER = $(SHAREDLIB).$(VERSION)
STATICLIBFLAGS = rcs
SHAREDLIBFLAGS = $(LDFLAGS) -shared -Wl,-soname,$(SHAREDLIB)
STATICLIB = lib$(LIBNAME).a
SRCS = $(addprefix src/, \
    debug.c error.c fifo.c ieee488.c \
@@ -44,9 +37,9 @@
TESTS_OBJS = $(TESTS:.c=.o)
TESTS_BINS = $(TESTS_OBJS:.o=.test)
.PHONY: all clean static shared test
.PHONY: all clean static test
all: static shared
all: static
$(OBJDIR):
@@ -61,17 +54,7 @@
$(DISTDIR)/$(STATICLIB): $(OBJS)
    $(AR) $(STATICLIBFLAGS) $(DISTDIR)/$(STATICLIB) $(OBJS)
$(DISTDIR)/$(SHAREDLIBVER): $(OBJS)
    $(CC) $(SHAREDLIBFLAGS) -o $(DISTDIR)/$(SHAREDLIBVER) $(OBJS)
$(DISTDIR)/$(SHAREDLIB): $(DISTDIR)/$(SHAREDLIBVER)
    $(RM) $(DISTDIR)/$(SHAREDLIB)
    ln -s $(SHAREDLIBVER) $(DISTDIR)/$(SHAREDLIB)
static: $(DISTDIR)/$(STATICLIB)
shared: $(DISTDIR)/$(SHAREDLIB)
$(OBJS): $(HDRS) $(DISTDIR) $(OBJDIR)