Changeset 8f16ede6 in mainline


Ignore:
Timestamp:
2019-05-14T18:24:48Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
e89dc0b
Parents:
3e1bc35
Message:

Turning old layouts into dynamic libraries

Adds new makefiles which creates dynamic
libraries for every layout. Extends existing
makefile for exposing those layout in the
distributed image

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile

    r3e1bc35 r8f16ede6  
    6060        done
    6161
     62ifeq ($(CONFIG_RTLD), y)
     63        for layout in $(USPACE_PATH)/srv/hid/input/layout/*.so ; do \
     64                mkdir -p "$(DIST_PATH)/lib/layouts/" ; \
     65                cp "$$layout" $(DIST_PATH)/lib/layouts/ ; \
     66        done
     67endif
     68       
    6269ifeq ($(CONFIG_DEVEL_FILES), y)
    6370        mkdir -p "$(DIST_PATH)/inc/c/"
  • uspace/srv/hid/input/layout.h

    r3e1bc35 r8f16ede6  
    5757
    5858extern layout_ops_t layout_default;
     59extern layout_ops_t layout_active;
    5960
    6061extern layout_t *layout_create(layout_ops_t *);
  • uspace/srv/hid/input/layout/Makefile

    r3e1bc35 r8f16ede6  
    66all:
    77        $(foreach LAYOUT,$(LAYOUTS), $(MAKE) -f Makefile.helper LAYOUT=$(LAYOUT) $@;)
    8        
     8        $(foreach LAYOUT,$(LAYOUTS), cp -p $(LAYOUT).so.0.0 $(LAYOUT).so;)
    99
    1010clean:
    1111        $(foreach LAYOUT,$(LAYOUTS), $(MAKE) -f Makefile.helper LAYOUT=$(LAYOUT) $@;)
     12        rm *.so
    1213
    1314fasterclean:
    1415        $(foreach LAYOUT,$(LAYOUTS), $(MAKE) -f Makefile.helper LAYOUT=$(LAYOUT) $@;)
     16        rm *.so
    1517
    1618all-test:
  • uspace/srv/hid/input/layout/Makefile.helper

    r3e1bc35 r8f16ede6  
    66SOURCES = $(LAYOUT).c
    77
     8EXTRA_CFLAGS = -DCONFIG_KB_LAYOUT_EXTERNAL
     9
    810include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/hid/input/layout/ar.c

    r3e1bc35 r8f16ede6  
    3636 */
    3737
     38#if !(defined(CONFIG_KB_LAYOUT_EXTERNAL) || defined(CONFIG_KB_LAYOUT_ar))
     39#error Invalid configuration of CONFIG_KB_LAYOUT
     40#else
     41
    3842#include <errno.h>
    3943#include <io/console.h>
     
    4650static wchar_t ar_parse_ev(layout_t *, kbd_event_t *ev);
    4751
    48 #ifdef CONFIG_KB_LAYOUT_ar
    49 
    50 layout_ops_t layout_default = {
     52static const layout_ops_t layout_intern = {
    5153        .create = ar_create,
    5254        .destroy = ar_destroy,
     
    5456};
    5557
    56 #else
    57 
     58#ifdef CONFIG_KB_LAYOUT_EXTERNAL
    5859layout_ops_t get_layout(void);
    59 layout_ops_t get_layout(void) {
    60         layout_ops_t layout_default = {
    61                 .create = ar_create,
    62                 .destroy = ar_destroy,
    63                 .parse_ev = ar_parse_ev
    64         };
    65         return layout_default;
    66 }
    67 
     60layout_ops_t get_layout(void)
     61{
     62        return layout_intern;
     63}
     64#else
     65layout_ops_t layout_default = layout_intern;
     66layout_ops_t layout_active = layout_intern;
    6867#endif
    6968
     
    256255}
    257256
     257#endif
     258
    258259/**
    259260 * @}
  • uspace/srv/hid/input/layout/cz.c

    r3e1bc35 r8f16ede6  
    3535 */
    3636
     37#if !(defined(CONFIG_KB_LAYOUT_EXTERNAL) || defined(CONFIG_KB_LAYOUT_cz))
     38#error Invalid configuration of CONFIG_KB_LAYOUT
     39#else
     40
    3741#include <errno.h>
    3842#include <io/console.h>
     
    4751static wchar_t cz_parse_ev(layout_t *, kbd_event_t *ev);
    4852
     53static const layout_ops_t layout_intern = {
     54        .create = cz_create,
     55        .destroy = cz_destroy,
     56        .parse_ev = cz_parse_ev
     57};
     58
     59#ifdef CONFIG_KB_LAYOUT_EXTERNAL
     60layout_ops_t get_layout(void);
     61layout_ops_t get_layout(void)
     62{
     63        return layout_intern;
     64}
     65#else
     66layout_ops_t layout_default = layout_intern;
     67layout_ops_t layout_active = layout_intern;
     68#endif
     69
    4970enum m_state {
    5071        ms_start,
     
    5677        enum m_state mstate;
    5778} layout_cz_t;
    58 
    59 #ifdef CONFIG_KB_LAYOUT_cz
    60 
    61 layout_ops_t layout_default = {
    62         .create = cz_create,
    63         .destroy = cz_destroy,
    64         .parse_ev = cz_parse_ev
    65 };
    66 
    67 #else
    68 
    69 layout_ops_t get_layout(void);
    70 layout_ops_t get_layout(void) {
    71         layout_ops_t layout_default = {
    72                 .create = cz_create,
    73                 .destroy = cz_destroy,
    74                 .parse_ev = cz_parse_ev
    75         };
    76         return layout_default;
    77 }
    78 
    79 #endif
    8079
    8180static wchar_t map_lcase[] = {
     
    447446}
    448447
     448#endif
     449
    449450/**
    450451 * @}
  • uspace/srv/hid/input/layout/us_dvorak.c

    r3e1bc35 r8f16ede6  
    3535 */
    3636
     37#if !(defined(CONFIG_KB_LAYOUT_EXTERNAL) || defined(CONFIG_KB_LAYOUT_us_dvorak))
     38#error Invalid configuration of CONFIG_KB_LAYOUT
     39#else
     40
    3741#include <errno.h>
    3842#include <io/console.h>
     
    4549static wchar_t us_dvorak_parse_ev(layout_t *, kbd_event_t *ev);
    4650
    47 #ifdef CONFIG_KB_LAYOUT_us_dvorak
    48 
    49 layout_ops_t layout_default = {
     51static const layout_ops_t layout_intern = {
    5052        .create = us_dvorak_create,
    5153        .destroy = us_dvorak_destroy,
     
    5355};
    5456
    55 #else
    56 
     57#ifdef CONFIG_KB_LAYOUT_EXTERNAL
    5758layout_ops_t get_layout(void);
    58 layout_ops_t get_layout(void) {
    59         layout_ops_t layout_default = {
    60                 .create = us_dvorak_create,
    61                 .destroy = us_dvorak_destroy,
    62                 .parse_ev = us_dvorak_parse_ev
    63         };
    64         return layout_default;
    65 }
    66 
     59layout_ops_t get_layout(void)
     60{
     61        return layout_intern;
     62}
     63#else
     64layout_ops_t layout_default = layout_intern;
     65layout_ops_t layout_active = layout_intern;
    6766#endif
    6867
     
    273272}
    274273
     274#endif
     275
    275276/**
    276277 * @}
  • uspace/srv/hid/input/layout/us_qwerty.c

    r3e1bc35 r8f16ede6  
    3535 */
    3636
     37#if !(defined(CONFIG_KB_LAYOUT_EXTERNAL) || defined(CONFIG_KB_LAYOUT_us_qwerty))
     38#error Invalid configuration of CONFIG_KB_LAYOUT
     39#else
     40
    3741#include <errno.h>
    3842#include <io/console.h>
     
    4549static wchar_t us_qwerty_parse_ev(layout_t *, kbd_event_t *ev);
    4650
    47 #ifdef CONFIG_KB_LAYOUT_us_qwerty
    48 
    49 layout_ops_t layout_default = {
     51static const layout_ops_t layout_intern = {
    5052        .create = us_qwerty_create,
    5153        .destroy = us_qwerty_destroy,
     
    5355};
    5456
    55 #else
    56 
     57#ifdef CONFIG_KB_LAYOUT_EXTERNAL
    5758layout_ops_t get_layout(void);
    58 layout_ops_t get_layout(void) {
    59         layout_ops_t layout_default = {
    60                 .create = us_qwerty_create,
    61                 .destroy = us_qwerty_destroy,
    62                 .parse_ev = us_qwerty_parse_ev
    63         };
    64         return layout_default;
    65 }
    66 
     59layout_ops_t get_layout(void)
     60{
     61        return layout_intern;
     62}
     63#else
     64layout_ops_t layout_default = layout_intern;
     65layout_ops_t layout_active = layout_intern;
    6766#endif
    6867
     
    267266}
    268267
     268#endif
     269
    269270/**
    270271 * @}
Note: See TracChangeset for help on using the changeset viewer.