treewide: restucture source tree per project
Signed-off-by: Max Regan <mgregan2@gmail.com>
This commit is contained in:
22
Makefile
22
Makefile
@@ -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/
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "common.h"
|
||||
#include "common/common.h"
|
||||
|
||||
void downcase(char *str)
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "tri.h"
|
||||
#include "common.h"
|
||||
#include "common/tri.h"
|
||||
#include "common/common.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdint.h>
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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; \
|
||||
@@ -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;
|
||||
|
||||
@@ -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[] =
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
@@ -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)
|
||||
@@ -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>
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "video.h"
|
||||
#include "gbemu/video.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
Reference in New Issue
Block a user