Changed and moved include files and changed Makefile

This commit is contained in:
g1n 2022-04-14 12:10:24 +03:00
parent b7d4d52189
commit 4d0f8d0b6a
Signed by: g1n
GPG Key ID: 8D352193D65D4E2C
9 changed files with 47 additions and 18 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*~
build

2
src/.gitignore vendored
View File

@ -1,2 +0,0 @@
*~
yemu

View File

@ -1,4 +1,4 @@
#include "6502.h" #include <yemu/6502.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,14 +1,28 @@
CC = gcc CC=cc
CFLAGS= -O2 -pedantic -Wall -Wextra
LFLAGS=
SRCFILES= main.c 6502/6502.c ocpu/ocpu.c SRCFILES!=ls -d */ | sed 's/include\///' | awk 'NF' | sed 's/.*/&\*.c/g'
OBJFILES= yemu
.PHONY: all clean BUILDDIR=../build
all: main CFILES=$(wildcard $(SRCFILES) *.c)
OFILES=$(patsubst %.c, $(BUILDDIR)/%.o, $(CFILES))
YEMUBIN=$(BUILDDIR)/yemu
main: INCLUDEFLAGS=-Iinclude/
$(CC) $(CFLAGS) $(SRCFILES) -o $(OBJFILES) DEBUGFLAGS=-fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize=pointer-compare -lasan
CFLAGS=-Wall -Wextra $(INCLUDEFLAGS) -g
LIBFLAGS=
.PHONY: all clean test
.SUFFIXES: .o .c
all: $(BUILDDIR) $(YEMUBIN)
$(BUILDDIR):
mkdir -p $(BUILDDIR)
$(YEMUBIN): $(CFILES)
$(CC) $(CFILES) -o $@ $(CFLAGS) $(LIBFLAGS)
clean:
rm -rf $(BUILDDIR)

View File

@ -1,5 +1,8 @@
#ifndef YEMU_6502_H
#define YEMU_6502_H
#include <stdio.h> #include <stdio.h>
#include "../common.h" #include <yemu/common.h>
#define MAX_MEMORY 1024*64 #define MAX_MEMORY 1024*64
@ -67,3 +70,5 @@ struct CPU {
}; };
void init6502(FILE *infile); void init6502(FILE *infile);
#endif

View File

@ -1,2 +1,7 @@
#ifndef YEMU_COMMON_H
#define YEMU_COMMON_H
typedef unsigned char byte; // 8 bit typedef unsigned char byte; // 8 bit
typedef unsigned short word; // 16 bit typedef unsigned short word; // 16 bit
#endif

View File

@ -1,5 +1,8 @@
#ifndef YEMU_OCPU_H
#define YEMU_OCPU_H
#include <stdio.h> #include <stdio.h>
#include "../common.h" #include <yemu/common.h>
#define MAX_MEMORY 1024*64 #define MAX_MEMORY 1024*64
@ -79,3 +82,5 @@ struct OCPU {
}; };
void initOCPU(FILE *infile); void initOCPU(FILE *infile);
#endif

View File

@ -1,6 +1,6 @@
#include "common.h" #include <yemu/common.h>
#include "6502/6502.h" #include <yemu/6502.h>
#include "ocpu/ocpu.h" #include <yemu/ocpu.h>
#include <stdio.h> #include <stdio.h>
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>

View File

@ -1,4 +1,4 @@
#include "ocpu.h" #include <yemu/ocpu.h>
struct OCPU ocpu; struct OCPU ocpu;
struct OCPU_MEMORY ocpu_mem; struct OCPU_MEMORY ocpu_mem;