change compiler name

This commit is contained in:
Lorenzo Torres 2025-11-30 22:57:52 +01:00
parent abf1d7c066
commit 771994fece
3 changed files with 23 additions and 25 deletions

View file

@ -3,14 +3,14 @@
include config.mk
SRC = cc.c utils.c lexer.c parser.c
SRC = lc.c utils.c lexer.c parser.c
HDR = config.def.h utils.h lexer.h parser.h sema.h
OBJ = ${SRC:.c=.o}
all: options cc
all: options lc
options:
@echo cc build options:
@echo lc build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
@ -26,30 +26,30 @@ config.h:
users.h:
cp users.def.h $@
cc: ${OBJ}
lc: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
clean:
rm -f cc ${OBJ} cc-${VERSION}.tar.gz
rm -f lc ${OBJ} lc-${VERSION}.tar.gz
dist: clean
mkdir -p cc-${VERSION}
mkdir -p lc-${VERSION}
cp -R LICENSE Makefile README config.mk\
cc.1 ${HDR} ${SRC} cc-${VERSION}
tar -cf cc-${VERSION}.tar cc-${VERSION}
gzip cc-${VERSION}.tar
rm -rf cc-${VERSION}
lc.1 ${HDR} ${SRC} lc-${VERSION}
tar -cf lc-${VERSION}.tar lc-${VERSION}
gzip lc-${VERSION}.tar
rm -rf lc-${VERSION}
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f cc ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/cc
cp -f lc ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/lc
mkdir -p ${DESTDIR}${MANPREFIX}/man1
sed "s/VERSION/${VERSION}/g" < cc.1 > ${DESTDIR}${MANPREFIX}/man1/cc.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/cc.1
sed "s/VERSION/${VERSION}/g" < lc.1 > ${DESTDIR}${MANPREFIX}/man1/lc.1
chmod 644 ${DESTDIR}${MANPREFIX}/man1/lc.1
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/cc\
${DESTDIR}${MANPREFIX}/man1/cc.1
rm -f ${DESTDIR}${PREFIX}/bin/lc\
${DESTDIR}${MANPREFIX}/man1/lc.1
.PHONY: all options clean dist install uninstall

12
README
View file

@ -1,19 +1,19 @@
cc - C compiler
lc - L compiler
============================
cc is a C compiler. It can compile C code.
lc is a L compiler. It can compile L code.
Requirements
------------
In order to build cc you need... a computer
In order to build lc you need... a computer
Installation
------------
Edit config.mk to match your local setup (cc is installed into
Edit config.mk to match your local setup (lc is installed into
the /usr/local namespace by default).
Afterwards enter the following command to build and install cc (if
Afterwards enter the following command to build and install lc (if
necessary as root):
make clean install
@ -21,4 +21,4 @@ necessary as root):
Usage
-----------
cc file
lc file

View file

@ -4,12 +4,10 @@
#include "lexer.h"
#include "parser.h"
// Helper to print indentation
void print_indent(int depth) {
for (int i = 0; i < depth; i++) printf(" ");
for (int i = 0; i < depth; i++) printf(" ");
}
// Helper to convert Binary Op enum to string
const char* get_op_str(binary_op op) {
switch(op) {
case OP_PLUS: return "+";