treewide: restucture source tree per project

Signed-off-by: Max Regan <mgregan2@gmail.com>
This commit is contained in:
2017-04-20 18:12:28 -07:00
parent 6ba525b64b
commit e5acc3088c
24 changed files with 43 additions and 45 deletions

View File

@@ -1,7 +1,8 @@
OUT=build
build=OUT
COV_DIR=$(OUT)/coverage/
SRC_DIR=src
APP_DIR=src/apps/
OUT=build
CC=gcc
@@ -36,9 +37,9 @@ LDFLAGS += -lglib-2.0
C_SOURCES = $(shell find $(SRC_DIR) -name "*.c")
ALL_OBJS = $(patsubst $(SRC_DIR)/%.c, $(OUT)/%.o, $(C_SOURCES))
APP_OBJS = $(filter $(OUT)/apps/%, $(ALL_OBJS))
OBJS = $(filter-out $(APP_OBJS), $(ALL_OBJS))
TEST_OBJS = $(filter $(OUT)%test.o, $(ALL_OBJS))
OBJS = $(filter-out $(TEST_OBJS) $(APP_OBJS), $(ALL_OBJS))
APPS = $(patsubst %.o, %, $(APP_OBJS))
.PHONY: all
all: gbdb gbasm tests
@@ -66,7 +67,7 @@ gbasm: $(OUT)/apps/gbasm
.PHONY: gbasm-test sample-test tests
TESTS=$(OUT)/apps/gbasm_test $(OUT)/apps/tri_test $(OUT)/apps/cpu_integ_test
TESTS = $(patsubst %.o, %, $(filter %/test.o, $(ALL_OBJS)))
tests: $(TESTS)
$(ALL_APPS) $(ALL_OBJS): $(CONFIG)
@@ -77,7 +78,7 @@ $(OUT)/%.o: $(SRC_DIR)/%.c
@$(CC) -c $(CCFLAGS) -o $@ $<
.SECONDEXPANSION:
$(APPS): $(OBJS) $$@.o
$(APPS) $(TESTS): $(OBJS) $$@.o
@echo " LD $@"
@$(shell mkdir -p $(@D))
@$(CC) $^ $(LDFLAGS) -o $@
@@ -106,13 +107,10 @@ $(COV_BASE):
@lcov -q -c -i -d $(OUT) -o $(COV_BASE)
$(COV_DIR)/coverage.info coverage: $(TESTS) $(COV_BASE)
@for test in $(TESTS); do \
echo " TEST $$test"; \
$$test -q; \
echo " LCOV $$(basename $$test)"; \
lcov -q -c -d $(OUT) -o $(COV_DIR)$$(basename $$test).info -t $$(basename $$test); \
done
@lcov -q $$(for i in $$(ls -1 $(COV_DIR)*.info); do echo "-a $$i"; done) -o $(COV_DIR)coverage.info
$(call run_tests)
@lcov -q -c -d $(OUT) -o $(COV_DIR)results.info -t results
@lcov -q -a $(COV_DIR)results.info -o $(COV_DIR)coverage.info
@lcov --summary $(COV_DIR)coverage.info
coverage-report: coverage
@mkdir -p $(COV_DIR)/html/

View File

@@ -10,11 +10,11 @@
#include <stdbool.h>
#include <signal.h>
#include "common.h"
#include "common/common.h"
#include "gb_disas.h"
#include "cpu.h"
#include "video.h"
#include "tri.h"
#include "gbemu/cpu.h"
#include "gbemu/video.h"
#include "common/tri.h"
#define INPUT_MAX_LEN 512
#define MAX_BREAKPTS 256 /* Should be plenty for anyone */

View File

@@ -1,4 +1,4 @@
#include "common.h"
#include "common/common.h"
void downcase(char *str)
{

View File

@@ -1,5 +1,5 @@
#include "tri.h"
#include "common.h"
#include "common/tri.h"
#include "common/common.h"
#include <glib.h>
#include <stdint.h>

View File

@@ -3,8 +3,8 @@
#include <string.h>
#include <stdio.h>
#include "tri.h"
#include "common.h"
#include "common/tri.h"
#include "common/common.h"
static size_t char_to_idx(char c)
{

View File

@@ -5,7 +5,7 @@
#include "gbasm/types.h"
#include "gbasm/errors.h"
#include "gbasm/opcodes.h"
#include "common.h"
#include "common/common.h"
#define GBASM_MAX_INSTS 1024

View File

@@ -4,7 +4,7 @@
#include <unistd.h>
#include "gbasm/emitter.h"
#include "common.h"
#include "common/common.h"
int emit(struct emitter *emitter, const void *data, size_t size)
{

View File

@@ -2,8 +2,8 @@
#include "gbasm/opcodes.h"
#include "gbasm/errors.h"
#include "tri.h"
#include "common.h"
#include "common/tri.h"
#include "common/common.h"
#define MAX_OPCODE_LEN 10 /*TODO: Check that's enough */

View File

@@ -2,8 +2,8 @@
#include "gbasm/opcodes.h"
#include "gbasm/errors.h"
#include "tri.h"
#include "common.h"
#include "common/tri.h"
#include "common/common.h"
#include <string.h>

View File

@@ -4,7 +4,7 @@
#include <errno.h>
#include <stdbool.h>
#include "common.h"
#include "common/common.h"
#include "gbasm/parser.h"
#include "gbasm/gb_types.h"
#include "gbasm/operands.h"

View File

@@ -1,5 +1,5 @@
#include "tests/gbasm/test.h"
#include "common.h"
#include "gbasm/tests/test.h"
#include "common/common.h"
#define GEN_FIXED_TEST(_opcode, _hex)\
uint8_t _opcode##_output[] = _hex; \

View File

@@ -1,8 +1,8 @@
#ifndef GBASM_TEST_FIXED_H
#define GBASM_TEST_FIXED_H
#include "tests/gbasm/test.h"
#include "common.h"
#include "gbasm/tests/test.h"
#include "common/common.h"
extern const struct gbasm_tests gbasm_fixed_tests;

View File

@@ -1,5 +1,5 @@
#include "tests/gbasm/test.h"
#include "common.h"
#include "gbasm/tests/test.h"
#include "common/common.h"
/* TODO: There is probably a better way to do this */
static const char all_src[] =

View File

@@ -1,8 +1,8 @@
#ifndef GBASM_TEST_INC_H
#define GBASM_TEST_INC_H
#include "tests/gbasm/test.h"
#include "common.h"
#include "gbasm/tests/test.h"
#include "common/common.h"
extern const struct gbasm_tests gbasm_inc_tests;

View File

@@ -1,9 +1,9 @@
#include "gbasm/assemble.h"
#include "gbasm/emitter.h"
#include "tests/gbasm/test.h"
#include "tests/gbasm/inc.h"
#include "tests/gbasm/fixed.h"
#include "common.h"
#include "gbasm/tests/test.h"
#include "gbasm/tests/inc.h"
#include "gbasm/tests/fixed.h"
#include "common/common.h"
#include <string.h> /* memset */
#include <glib.h>

View File

@@ -6,8 +6,8 @@
#include <stdio.h>
#include <string.h>
#include "cpu.h"
#include "common.h"
#include "gbemu/cpu.h"
#include "common/common.h"
#define WRITE_BIT(x, idx, bit) \
do {(x) &= (~(1 << (idx)) | ((bit) << (idx)));} while(0)

View File

@@ -1,7 +1,7 @@
#include "gbasm/assemble.h"
#include "gbasm/emitter.h"
#include "cpu.h"
#include "common.h"
#include "gbemu/cpu.h"
#include "common/common.h"
#include <string.h> /* memset */
#include <glib.h>

View File

@@ -1,4 +1,4 @@
#include "video.h"
#include "gbemu/video.h"
#include <string.h>