mirror of
https://github.com/sigmasternchen/libargo
synced 2025-03-15 05:08:54 +00:00
restructure; added marshaller to root tree
This commit is contained in:
parent
b4ae51cabe
commit
ae0fda3384
17 changed files with 59 additions and 59 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -51,5 +51,11 @@ Module.symvers
|
||||||
Mkfile.old
|
Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
|
|
||||||
demo
|
json-demo
|
||||||
marshaller-demo
|
marshaller-demo
|
||||||
|
json-test
|
||||||
|
marshaller-test
|
||||||
|
marshaller-gen
|
||||||
|
|
||||||
|
gen/**
|
||||||
|
obj/**
|
||||||
|
|
79
Makefile
79
Makefile
|
@ -5,17 +5,23 @@ LDFLAGS =
|
||||||
AR = ar
|
AR = ar
|
||||||
ARFLAGS = rcs
|
ARFLAGS = rcs
|
||||||
|
|
||||||
BIN_NAME = demo
|
LEX = flex
|
||||||
|
YACC = bison
|
||||||
|
YFLAGS = -y -d
|
||||||
|
|
||||||
|
MARSHALLER_GEN = marshaller-gen
|
||||||
|
|
||||||
A_LIB_NAME = libcson.a
|
A_LIB_NAME = libcson.a
|
||||||
SO_LIB_NAME = libcson.so
|
SO_LIB_NAME = libcson.so
|
||||||
|
|
||||||
OBJS = obj/base.o obj/parse.o obj/query.o obj/stringify.o
|
OBJS = obj/base.o obj/parse.o obj/query.o obj/stringify.o obj/marshaller.o
|
||||||
DEPS = $(OBJS:%.o=%.d)
|
DEPS = $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
all: $(A_LIB_NAME) $(SO_LIB_NAME) $(BIN_NAME)
|
all: $(A_LIB_NAME) $(SO_LIB_NAME) tests
|
||||||
|
|
||||||
$(BIN_NAME): obj/demo.o $(OBJS)
|
tests: json-test marshaller-test
|
||||||
$(LD) $(LDFLAGS) -o $@ $^
|
./json-test
|
||||||
|
./marshaller-test
|
||||||
|
|
||||||
$(A_LIB_NAME): CFLAGS += -fPIC
|
$(A_LIB_NAME): CFLAGS += -fPIC
|
||||||
$(A_LIB_NAME): $(OBJS)
|
$(A_LIB_NAME): $(OBJS)
|
||||||
|
@ -25,46 +31,57 @@ $(SO_LIB_NAME): CFLAGS += -fPIC
|
||||||
$(SO_LIB_NAME): $(OBJS)
|
$(SO_LIB_NAME): $(OBJS)
|
||||||
$(LD) -shared -o $@ $^
|
$(LD) -shared -o $@ $^
|
||||||
|
|
||||||
marshaller-lib: $(A_LIB_NAME) obj/marshaller.o
|
|
||||||
$(AR) rs $(A_LIB_NAME) obj/marshaller.o
|
|
||||||
|
|
||||||
test: obj/test.o $(OBJS)
|
|
||||||
$(LD) $(LDFLAGS) -o $@ $^
|
|
||||||
|
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
||||||
obj/marshaller.o: CFLAGS += -Isrc/
|
|
||||||
obj/marshaller.o: marshaller/lib/marshaller.c
|
|
||||||
$(CC) $(CFLAGS) -MMD -c -o $@ $<
|
|
||||||
|
|
||||||
obj/%.o: src/%.c obj
|
obj/%.o: src/%.c obj
|
||||||
$(CC) $(CFLAGS) -MMD -c -o $@ $<
|
$(CC) $(CFLAGS) -MMD -c -o $@ $<
|
||||||
|
|
||||||
obj:
|
obj:
|
||||||
@mkdir -p obj
|
mkdir -p obj
|
||||||
|
|
||||||
marshaller-demo: marshaller/gen/demo.tab.c marshaller/demo/demo.c marshaller/lib/marshaller.c $(A_LIB_NAME)
|
$(MARSHALLER_GEN): marshaller/codegen.c gen/lex.yy.c gen/y.tab.c
|
||||||
$(CC) $(CFLAGS) -Imarshaller/demo/ -Isrc/ -Imarshaller/lib/ -o $@ $^
|
$(CC) $(CFLAGS) -Imarshaller/ -o $@ $^
|
||||||
|
|
||||||
marshaller/gen/demo.tab.c: marshaller/demo/demo.h marshaller/marshaller-gen
|
gen/y.tab.c gen/y.tab.h: marshaller/parser.y gen
|
||||||
./marshaller/marshaller-gen -o $@ $<
|
$(YACC) $(YFLAGS) $<
|
||||||
|
mv y.tab.c gen/
|
||||||
marshaller/marshaller-gen:
|
mv y.tab.h gen/
|
||||||
$(MAKE) -C marshaller/ marshaller-gen
|
|
||||||
|
|
||||||
marshaller-test: marshaller/gen/test.tab.c marshaller/test/test.c marshaller/lib/marshaller.c $(A_LIB_NAME)
|
gen/lex.yy.c: marshaller/scanner.l gen/y.tab.h gen
|
||||||
$(CC) -g -Imarshaller/test/ -Isrc/ -Imarshaller/lib/ -o $@ $^
|
$(LEX) $<
|
||||||
|
mv lex.yy.c gen/
|
||||||
|
|
||||||
marshaller/gen/test.tab.c: marshaller/test/test*.h marshaller/marshaller-gen
|
gen:
|
||||||
./marshaller/marshaller-gen -o $@ marshaller/test/test*.h
|
mkdir -p gen/
|
||||||
|
|
||||||
|
|
||||||
|
json-demo: demo/json.c $(A_LIB_NAME)
|
||||||
|
$(CC) $(CFLAGS) -Isrc/ -o $@ $^
|
||||||
|
|
||||||
|
marshaller-demo: gen/demo.tab.c demo/marshaller.c $(A_LIB_NAME)
|
||||||
|
$(CC) $(CFLAGS) -Isrc/ -Idemo/ -Isrc/ -o $@ $^
|
||||||
|
|
||||||
|
gen/demo.tab.c: demo/demo.h $(MARSHALLER_GEN)
|
||||||
|
$(MARSHALLER_GEN) -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
|
json-test: test/json.c $(A_LIB_NAME)
|
||||||
|
$(CC) $(CFLAGS) -Isrc/ -o $@ $^
|
||||||
|
|
||||||
|
marshaller-test: gen/test.tab.c test/marshaller.c $(A_LIB_NAME)
|
||||||
|
$(CC) -g -Itest/ -Isrc/ -o $@ $^
|
||||||
|
|
||||||
|
gen/test.tab.c: test/test*.h $(MARSHALLER_GEN)
|
||||||
|
./$(MARSHALLER_GEN) -o $@ test/test*.h
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "Cleaning up..."
|
@echo "Cleaning up..."
|
||||||
@rm -f obj/*.o
|
@rm -f obj/*.o
|
||||||
@rm -f obj/*.d
|
@rm -f obj/*.d
|
||||||
@rm -f test
|
@rm -f gen/*.c
|
||||||
@rm -f $(BIN_NAME)
|
|
||||||
@rm -f $(A_LIB_NAME)
|
@rm -f $(A_LIB_NAME)
|
||||||
@rm -f $(SO_LIB_NAME)
|
@rm -f $(SO_LIB_NAME)
|
||||||
@rm -f marshaller-demo marshaller-test
|
@rm -f json-demo
|
||||||
$(MAKE) -C marshaller/ clean
|
@rm -f json-test
|
||||||
|
@rm -f marshaller-demo
|
||||||
|
@rm -f marshaller-test
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
LEX = flex
|
|
||||||
YACC = bison
|
|
||||||
YFLAGS = -y -d
|
|
||||||
CC = gcc
|
|
||||||
|
|
||||||
BIN_NAME = marshaller-gen
|
|
||||||
|
|
||||||
$(BIN_NAME): src/codegen.c gen/lex.yy.c gen/y.tab.c
|
|
||||||
$(CC) -Isrc/ -o $@ $^
|
|
||||||
|
|
||||||
gen/y.tab.c gen/y.tab.h: src/parser.y gen
|
|
||||||
$(YACC) $(YFLAGS) $<
|
|
||||||
mv y.tab.c gen/
|
|
||||||
mv y.tab.h gen/
|
|
||||||
|
|
||||||
gen/lex.yy.c: src/scanner.l gen/y.tab.h gen
|
|
||||||
$(LEX) $<
|
|
||||||
mv lex.yy.c gen/
|
|
||||||
|
|
||||||
gen:
|
|
||||||
mkdir -p gen/
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f gen/* $(BIN_NAME)
|
|
|
@ -193,6 +193,8 @@ struct structinfo* newStructInfo() {
|
||||||
info->names[1] = NULL;
|
info->names[1] = NULL;
|
||||||
info->memberno = 0;
|
info->memberno = 0;
|
||||||
info->members = NULL;
|
info->members = NULL;
|
||||||
|
|
||||||
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct declarsinfo* newDeclarsInfo() {
|
struct declarsinfo* newDeclarsInfo() {
|
|
@ -3,8 +3,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <json.h>
|
#include "json.h"
|
||||||
|
|
||||||
#include "marshaller.h"
|
#include "marshaller.h"
|
||||||
|
|
||||||
void _marshallPanic(const char* name, const char* reason) {
|
void _marshallPanic(const char* name, const char* reason) {
|
|
@ -5,7 +5,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "json.h"
|
#include <json.h>
|
||||||
|
|
||||||
|
|
||||||
bool global = true;
|
bool global = true;
|
Loading…
Reference in a new issue