Skip to content

Commit

Permalink
move lib/ to platform/ and build and link correct dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossless committed Feb 12, 2024
1 parent 9e58cf8 commit 2e84b68
Show file tree
Hide file tree
Showing 28 changed files with 26 additions and 24 deletions.
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ MAIN_SOURCES := $(SRCDIR)/main.c \
$(LAYOUT_SOURCES)
MAIN_OBJECTS := $(MAIN_SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.rel)

LIBSINO8051_SOURCES := $(wildcard $(SRCDIR)/lib/sh68f90a/*.c)
LIBSINO8051_OBJECTS := $(LIBSINO8051_SOURCES:$(SRCDIR)/lib/sh68f90a/%.c=$(OBJDIR)/lib/sh68f90a/%.rel)
PLATFORM_SOURCES := $(wildcard $(SRCDIR)/platform/sh68f90a/*.c)
PLATFORM_OBJECTS := $(PLATFORM_SOURCES:$(SRCDIR)/platform/sh68f90a/%.c=$(OBJDIR)/platform/sh68f90a/%.rel)
PLATFORM_LIB := platform

USER_SOURCES := $(wildcard $(SRCDIR)/user/*.c)
USER_OBJECTS := $(USER_SOURCES:$(SRCDIR)/user/%.c=$(OBJDIR)/user/%.rel)
USER_LIB := user

KEYBOARDS_LAYOUTS = nuphy-air60_default

Expand All @@ -75,17 +77,17 @@ $(OBJDIR)/%.rel: $(SRCDIR)/%.c
@mkdir -p $(@D)
$(CC) -m$(FAMILY) -l$(PROC) $(CFLAGS) -c $< -o $@

$(BINDIR)/overridable.lib: $(OVERRIDABLE_OBJECTS)
$(BINDIR)/user.lib: $(USER_OBJECTS)
@mkdir -p $(@D)
$(SDAR) $@ $^

$(BINDIR)/sino8051.lib: $(LIBSINO8051_OBJECTS)
$(BINDIR)/platform.lib: $(PLATFORM_OBJECTS)
@mkdir -p $(@D)
$(SDAR) $@ $^

$(BINDIR)/%.ihx: $(MAIN_OBJECTS) $(BINDIR)/sino8051.lib $(BINDIR)/overridable.lib
$(BINDIR)/%.ihx: $(MAIN_OBJECTS) $(BINDIR)/$(PLATFORM_LIB).lib $(BINDIR)/$(USER_LIB).lib
@mkdir -p $(@D)
$(CC) -m$(FAMILY) -l$(PROC) $(LFLAGS) -o $@ $(MAIN_OBJECTS) -L$(BINDIR) -loverridable -lsino8051
$(CC) -m$(FAMILY) -l$(PROC) $(LFLAGS) -o $@ $(MAIN_OBJECTS) -L$(BINDIR) -l$(USER_LIB) -l$(PLATFORM_LIB)

$(BINDIR)/%.hex: $(BINDIR)/%.ihx
${PACKIHX} < $< > $@
Expand Down
2 changes: 1 addition & 1 deletion src/keyboards/nuphy-air60/kbdef.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef KBDEF_H
#define KBDEF_H

#include "../../lib/sh68f90a/sh68f90a.h"
#include "../../platform/sh68f90a/sh68f90a.h"

#define MATRIX_ROWS 5
#define MATRIX_COLS 16
Expand Down
4 changes: 2 additions & 2 deletions src/keyboards/nuphy-air60/layouts/default/indicators.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../../../../user/indicators.h"
#include "../../../../lib/sh68f90a/sh68f90a.h"
#include "../../../../lib/sh68f90a/pwm.h"
#include "../../../../platform/sh68f90a/sh68f90a.h"
#include "../../../../platform/sh68f90a/pwm.h"
#include <stdlib.h>

void indicators_pre_update()
Expand Down
18 changes: 9 additions & 9 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "lib/sh68f90a/clock.h"
#include "lib/sh68f90a/ldo.h"
#include "lib/sh68f90a/watchdog.h"
#include "lib/sh68f90a/delay.h"
#include "lib/sh68f90a/isp.h"
#include "lib/sh68f90a/uart.h"
#include "lib/sh68f90a/gpio.h"
#include "lib/sh68f90a/pwm.h"
#include "lib/sh68f90a/usb.h"
#include "platform/sh68f90a/clock.h"
#include "platform/sh68f90a/ldo.h"
#include "platform/sh68f90a/watchdog.h"
#include "platform/sh68f90a/delay.h"
#include "platform/sh68f90a/isp.h"
#include "platform/sh68f90a/uart.h"
#include "platform/sh68f90a/gpio.h"
#include "platform/sh68f90a/pwm.h"
#include "platform/sh68f90a/usb.h"
#include "smk/debug.h"
#include "smk/matrix.h"
#include "smk/utils.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/smk/host.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "host.h"
#include "debug.h"
#include "../lib/sh68f90a/usb.h"
#include "../platform/sh68f90a/usb.h"

/* send report */
void host_keyboard_send(report_keyboard_t *report)
Expand Down
6 changes: 3 additions & 3 deletions src/smk/matrix.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "matrix.h"
#include "report.h"
#include "debug.h"
#include "../lib/sh68f90a/sh68f90a.h"
#include "../lib/sh68f90a/pwm.h"
#include "../lib/sh68f90a/delay.h"
#include "../platform/sh68f90a/sh68f90a.h"
#include "../platform/sh68f90a/pwm.h"
#include "../platform/sh68f90a/delay.h"
#include "../user/layout.h"
#include "../user/indicators.h"
#include "../user/matrix.h"
Expand Down
2 changes: 1 addition & 1 deletion src/user/indicators.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../indicators.h"
#include "indicators.h"

bool indicators_update_step(keyboard_state_t *keyboard, uint8_t current_step)
{
Expand Down
2 changes: 1 addition & 1 deletion src/user/layout.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../layout.h"
#include "layout.h"

bool process_record_user(uint16_t keycode, bool key_pressed)
{
Expand Down

0 comments on commit 2e84b68

Please sign in to comment.