forked from pyrite-dev/pmake
init
This commit is contained in:
commit
32d4e8c6f2
15 changed files with 108626 additions and 0 deletions
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
/external/*/*.c linguist-generated
|
||||||
|
/external/*/*.h linguist-generated
|
||||||
|
/mk/*.mk linguist-generated
|
||||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
/pmake*
|
||||||
|
*.o
|
||||||
|
/src/compiler/*.c
|
||||||
78
GNUmakefile
Normal file
78
GNUmakefile
Normal file
|
|
@ -0,0 +1,78 @@
|
||||||
|
TARGET =
|
||||||
|
|
||||||
|
ifeq ($(TARGET),)
|
||||||
|
TARGET = $(shell uname -s)
|
||||||
|
endif
|
||||||
|
|
||||||
|
### Platforms
|
||||||
|
ifeq ($(TARGET),Linux)
|
||||||
|
UNIX = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET),NetBSD)
|
||||||
|
UNIX = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
### Stuff
|
||||||
|
ifeq ($(UNIX),1)
|
||||||
|
CC = gcc
|
||||||
|
CFLAGS = -c
|
||||||
|
LDFLAGS =
|
||||||
|
LIBS = -lm
|
||||||
|
|
||||||
|
EXE =
|
||||||
|
endif
|
||||||
|
|
||||||
|
### Common flags
|
||||||
|
CFLAGS += -Iexternal/duktape -Iexternal/stb
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
OBJS = src/main.o
|
||||||
|
OBJS += external/duktape/duktape.o external/stb/stb_ds.o
|
||||||
|
|
||||||
|
.PHONY: all clean mk maint
|
||||||
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
all: pmake$(EXE)
|
||||||
|
|
||||||
|
include mk/compiler.mk
|
||||||
|
|
||||||
|
mk/compiler.mk:
|
||||||
|
find src/compiler -name "*.js" | while read js; do \
|
||||||
|
name="compiler_`echo $$js | rev | cut -d/ -f1 | rev | cut -d. -f1`" ; \
|
||||||
|
c="`echo $$js | sed 's/\.js$$/.c/'`" ; \
|
||||||
|
o="`echo $$js | sed 's/\.js$$/.o/'`" ; \
|
||||||
|
echo "OBJS += $$o" ; \
|
||||||
|
echo "$$c: $$js" ; \
|
||||||
|
echo " xxd -n$$name -i $$js > $$c" ; \
|
||||||
|
echo "" ; \
|
||||||
|
done > $@
|
||||||
|
|
||||||
|
mk: mk/compiler.mk
|
||||||
|
|
||||||
|
maint:
|
||||||
|
rm -f mk/*.mk
|
||||||
|
$(MAKE) mk
|
||||||
|
rm -f src/config.h
|
||||||
|
$(MAKE) src/config.h
|
||||||
|
|
||||||
|
src/config.h:
|
||||||
|
echo "#ifndef __CONFIG_H__" > $@
|
||||||
|
echo "#define __CONFIG_H__" >> $@
|
||||||
|
echo "" >> $@
|
||||||
|
echo "#define COMPILERS \\" >> $@
|
||||||
|
find src/compiler -name "*.js" | while read js; do \
|
||||||
|
echo " X(`echo $$js | rev | cut -d/ -f1 | rev | cut -d. -f1`) \\" ; \
|
||||||
|
done >> $@
|
||||||
|
echo "" >> $@
|
||||||
|
echo "#endif" >> $@
|
||||||
|
|
||||||
|
pmake$(EXE): $(OBJS)
|
||||||
|
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
find . -name "*.o" >/dev/null && rm -f $(shell find . -name "*.o")
|
||||||
|
rm -f src/compiler/*.c
|
||||||
24
LICENSE
Normal file
24
LICENSE
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
Copyright (c) 2026, Pyrite development team
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the <organization> nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
3779
external/duktape/duk_config.h
generated
vendored
Normal file
3779
external/duktape/duk_config.h
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
101351
external/duktape/duktape.c
generated
vendored
Normal file
101351
external/duktape/duktape.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1456
external/duktape/duktape.h
generated
vendored
Normal file
1456
external/duktape/duktape.h
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
external/stb/stb_ds.c
generated
vendored
Normal file
2
external/stb/stb_ds.c
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#define STB_DS_IMPLEMENTATION
|
||||||
|
#include "stb_ds.h"
|
||||||
1895
external/stb/stb_ds.h
generated
vendored
Normal file
1895
external/stb/stb_ds.h
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
8
mk/compiler.mk
generated
Normal file
8
mk/compiler.mk
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
OBJS += src/compiler/watcom.o
|
||||||
|
src/compiler/watcom.c: src/compiler/watcom.js
|
||||||
|
xxd -ncompiler_watcom -i src/compiler/watcom.js > src/compiler/watcom.c
|
||||||
|
|
||||||
|
OBJS += src/compiler/gcc.o
|
||||||
|
src/compiler/gcc.c: src/compiler/gcc.js
|
||||||
|
xxd -ncompiler_gcc -i src/compiler/gcc.js > src/compiler/gcc.c
|
||||||
|
|
||||||
2
src/compiler/gcc.js
Normal file
2
src/compiler/gcc.js
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
class GCC extends Compiler {
|
||||||
|
};
|
||||||
2
src/compiler/watcom.js
Normal file
2
src/compiler/watcom.js
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
class Watcom extends Compiler {
|
||||||
|
};
|
||||||
8
src/config.h
Normal file
8
src/config.h
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef __CONFIG_H__
|
||||||
|
#define __CONFIG_H__
|
||||||
|
|
||||||
|
#define COMPILERS \
|
||||||
|
X(watcom) \
|
||||||
|
X(gcc) \
|
||||||
|
|
||||||
|
#endif
|
||||||
4
src/main.c
Normal file
4
src/main.c
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#include "pmake.h"
|
||||||
|
|
||||||
|
int main(int argc, char** argv){
|
||||||
|
}
|
||||||
11
src/pmake.h
Normal file
11
src/pmake.h
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef __PMAKE_H__
|
||||||
|
#define __PMAKE_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <duktape.h>
|
||||||
|
#include <stb_ds.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue