Create Makefile for building with cosmocc

Resolves #9.
This commit is contained in:
Stephen Seo 2024-06-28 13:02:26 +09:00
parent dc9ddcfa76
commit 5b60a2fe1b
2 changed files with 33 additions and 0 deletions

2
cosmopolitan/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
/objdir/
/out/

31
cosmopolitan/Makefile Normal file
View file

@ -0,0 +1,31 @@
COSMOCC ?= ${HOME}/Downloads/cosmocc/bin/cosmocc
OBJDIR = objdir
OUTDIR = out
SOURCES = \
../src/main.c \
../src/parser.c
HEADERS = \
../src/parser.h
OBJECTS = $(addprefix ${OBJDIR}/,$(subst ..,PREVDIR,$(patsubst %.c,%.c.o,${SOURCES})))
all: actually_portable_simplearchiver
actually_portable_simplearchiver: ${OBJECTS}
@mkdir -p "${OUTDIR}"
${COSMOCC} -o "${OUTDIR}/actually_portable_simplearchiver" $^
.PHONY: clean
clean:
rm -rf "${OUTDIR}"
rm -rf "${OBJDIR}"
.SECONDEXPANSION:
${OBJDIR}/%.c.o: $$(subst PREVDIR,..,%.c) ${HEADERS}
@mkdir -p "$(dir $@)"
${COSMOCC} -c ${OTHER_FLAGS} -o $@ $<