Initial commit

This commit is contained in:
2026-02-08 12:14:24 -06:00
commit f183ed2147
7 changed files with 141 additions and 0 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

56
Makefile Normal file
View File

@@ -0,0 +1,56 @@
# Compiler settings
CC=gcc
CFLAGS=-std=c11 -Wall -Wextra -O2 -Iinclude
SHELL=/bin/sh
# Directories
SRCDIR=src
INCDIR=include
OBJDIR=build
DISTDIR=dist
TESTDIR=tests
# Platform-specific sources
ifeq ($(OS),Windows_NT)
PLATFORM_SRC=$(SRCDIR)/win32_platform.c
OBJEXT=obj
LIBEXT=dll
RM=del /Q
MKDIR=if not exist "$(1)" mkdir "$(1)"
else
PLATFORM_SRC=$(SRCDIR)/linux_platform.c
OBJEXT=o
LIBEXT=so
RM=rm -f
MKDIR=mkdir -p $(1)
endif
# Sources and objects
SRC=$(PLATFORM_SRC) $(TESTDIR)/main.c
OBJ=$(patsubst %.c,$(OBJDIR)/%.$(OBJEXT),$(SRC))
# Targets
.PHONY: all clean run
all: $(DISTDIR)/app
# Build main executable
$(DISTDIR)/app: $(OBJ)
@$(call MKDIR,$(DISTDIR))
$(CC) $(CFLAGS) $(OBJ) -o $@
# Compile object files
$(OBJDIR)/%.$(OBJEXT): %.c
@$(call MKDIR,$(dir $@))
$(CC) $(CFLAGS) -c $< -o $@
# Run the app
run: $(DISTDIR)/app
$(DISTDIR)/app
# Clean
clean:
-$(RM) $(OBJ)
-$(RM) $(DISTDIR)/*
@echo "Cleaned build and dist directories"

34
README.md Normal file
View File

@@ -0,0 +1,34 @@
# EG
## Description
This repository contains eg or "for example" files. That includes this README and LICENSE.
`~/eg`is a $HOME directory for me and is marked as an XDG template folder.
This allows you to easily create files from "templates" on a desktop.
It also serves as a filepath `~/eg` for scripts and automation.
## Table of Contents
- [Description](#description)
- [Features](#features)
- [Usage](#usage)
- [Credits / Resources](#credits--resources)
- [License](#license)
## Features
+ Easy to copy.
+ Defaults to revert to.
+ Templates for easy productivity.
## Usage
Just copy and paste into your projects.<br>
/dev - Files used in development.<br>
/dot - Files used in configuration.<br>
## Credits / Resources
[Tom Preston-Werner README Driven Development](https://tom.preston-werner.com/2010/08/23/readme-driven-development)<br>
[Make a README](https://www.makeareadme.com/)<br>
[Choose a LICENSE](https://choosealicense.com/)<br>
## License
This project is licensed under MIT - see the [LICENSE](LICENSE) file for details.

7
include/platform.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef PLATFORM_H
#define PLATFORM_H
void platform_print(void);
#endif

8
src/linux_platform.c Normal file
View File

@@ -0,0 +1,8 @@
#include "../include/platform.h"
#include <stdio.h>
void platform_print(void)
{
printf("Linux platform\n");
}

7
src/win32_platform.c Normal file
View File

@@ -0,0 +1,7 @@
#include "../include/platform.h"
#include <stdio.h>
void platform_print(void)
{
printf("Windows platform\n");
}

8
tests/main.c Normal file
View File

@@ -0,0 +1,8 @@
#include "../include/platform.h"
int main(void)
{
platform_print();
return 0;
}