Skip to content

Commit

Permalink
Speedup makefile, update license to 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
dosisod committed Jan 2, 2022
1 parent bfa5ec4 commit 656c08e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2021 dosisod
Copyright (c) 2020-2022 dosisod

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ build/test/test: $(OBJS_LLVM) $(OBJS_TEST) $(ODIR)/skull/real_main.o
@$(ECHO) "\033[92mLink\033[0m test\n"
@$(CC) $^ -o build/test/test $(CFLAGS) $(LLVM_LDFLAGS)

build/skull/skull: $(OBJS) $(OBJS_LLVM) $(ODIR)/skull/real_main.o
build/skull/skull: $(OBJS) $(OBJS_LLVM) $(ODIR)/skull/real_main.o $(ODIR)/skull/cli.o
@$(ECHO) "\033[92mLink\033[0m skull\n"
@$(CC) $^ -DRELEASE=$(RELEASE) -DSKULL_VERSION="\"$(SKULL_VERSION)\"" \
skull/cli.c -o build/skull/skull \
-o build/skull/skull \
$(CFLAGS) $(LLVM_LDFLAGS) $(LLVM_CFLAGS)

build/test/embed: test/embed.c
Expand All @@ -50,11 +50,11 @@ test/sh/e2e_inner.h: $(E2E)
@$(ECHO) "\033[92mGenerate\033[0m e2e_inner\n"
@cat $(E2E) > test/sh/e2e_inner.h

E2E_DEPS=$(OBJS) $(OBJS_LLVM) $(ODIR)/skull/real_main.o $(ODIR)/test/testing.o
build/test/e2e: test/sh/e2e_inner.h $(E2E_DEPS)
$(ODIR)/test/skull/e2e.o: test/sh/e2e_inner.h

build/test/e2e: $(OBJS) $(OBJS_LLVM) $(ODIR)/skull/real_main.o $(ODIR)/test/testing.o $(ODIR)/test/skull/e2e.o
@$(ECHO) "\033[92mLink\033[0m e2e tests\n"
@$(CC) $(E2E_DEPS) test/skull/e2e.c -o build/test/e2e \
$(CFLAGS) $(LLVM_LDFLAGS) $(LLVM_CFLAGS)
@$(CC) $^ -o build/test/e2e $(CFLAGS) $(LLVM_LDFLAGS) $(LLVM_CFLAGS)

docs:
@$(ECHO) "\033[92mBuild\033[0m docs\n"
Expand Down
13 changes: 6 additions & 7 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ BIN := /usr/local/bin
HEADER := /usr/include
MANPATH := $(shell manpath | cut -d : -f1)/man1/

CC = $(shell readlink -f `which cc`)
CC := $(shell readlink -f `which cc`)
CXX ?= g++

SKULL_VERSION=$(shell git describe --always)
SKULL_VERSION := $(shell git describe --always)

ECHO=printf

Expand Down Expand Up @@ -55,17 +55,16 @@ CFLAGS += -std=c18 \
-I. \
-DSKULL_VERSION="\"$(SKULL_VERSION)\""

LLVM_CONFIG = $(shell command -v llvm-config-13 || command -v llvm-config)

LLVM_CFLAGS = $(shell $(LLVM_CONFIG) --cflags)
LLVM_CONFIG := $(shell command -v llvm-config-13 || command -v llvm-config)
LLVM_CFLAGS := $(shell $(LLVM_CONFIG) --cflags)

RELEASE ?= 0
ifeq ($(RELEASE), 1)
LLVM_LDFLAGS = $(shell $(LLVM_CONFIG) --libfiles --link-static) \
LLVM_LDFLAGS := $(shell $(LLVM_CONFIG) --libfiles --link-static) \
$(shell $(CXX) -print-file-name=libstdc++.a) \
-lm -lpthread -lncurses -lz
else
LLVM_LDFLAGS = $(shell $(LLVM_CONFIG) --libs)
LLVM_LDFLAGS := $(shell $(LLVM_CONFIG) --libs)
endif


Expand Down

0 comments on commit 656c08e

Please sign in to comment.