aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--Makefile44
-rw-r--r--src/calculer.c4
-rw-r--r--src/cli.c1
-rw-r--r--src/disp.c1
-rw-r--r--src/ray.c1
6 files changed, 50 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d18d6f5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+calculer
+src/calc_data.o
+src/calculer.o
+src/disp.o
+src/input.o
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..776e988
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+PREFIX ?= /usr/local
+PROG ?= calculer
+CFLAGS ?= -O0 -g3
+LDFLAGS ?=
+LIBS ?=
+
+
+CALCULER_VERSION := 1.0
+
+__CFLAGS := -std=c99 \
+ -Wall \
+ -DCALCULER_VERSION=\"$(CALCULER_VERSION)\" \
+ $(shell pkg-config --cflags readline)
+__LDFLAGS :=
+__LIBS := $(shell pkg-config --libs readline)
+
+all: $(PROG)
+
+$(PROG): src/calc_data.o src/calculer.o src/disp.o src/input.o
+ $(CC) -o $@ $^ $(__LDFLAGS) $(__LIBS) $(LDFLAGS) $(LIBS)
+
+src/calc_data.o: src/calc_data.c src/calc_data.h
+src/calculer.o: src/calculer.c src/disp.h
+src/disp.o: src/disp.c src/disp.h
+.c.o:
+ $(CC) $(__CFLAGS) $(CFLAGS) -o $@ -c $<
+
+install: $(PROG)
+ mkdir -p $(PREFIX)/bin
+ install --mode=0755 $(PROG) $(PREFIX)/bin/
+
+uninstall:
+ rm -rf $(PREFIX)/bin/$(PROG)
+
+clean:
+ rm -rf $(PROG) *.tar.gz src/*.o
+
+dist:
+ git archive \
+ --output="calculer-$(CALCULER_VERSION).tar.gz" \
+ --prefix="calculer-$(CALCULER_VERSION)/" \
+ HEAD
+
+.PHONY: all clean dist install uninstall
diff --git a/src/calculer.c b/src/calculer.c
index 6bf8fbb..a3512d0 100644
--- a/src/calculer.c
+++ b/src/calculer.c
@@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
-
#include <assert.h>
#include <limits.h>
#include <stdint.h>
@@ -115,7 +113,7 @@ print_help(void)
void
print_version(void)
{
- printf("%s\n", VERSION);
+ printf("%s\n", CALCULER_VERSION);
}
void
diff --git a/src/cli.c b/src/cli.c
index afbb540..a24d771 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
#include <stdlib.h>
#include <stdio.h>
diff --git a/src/disp.c b/src/disp.c
index 26bb2f2..02f9bdc 100644
--- a/src/disp.c
+++ b/src/disp.c
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
#include <dlfcn.h>
#include <limits.h>
diff --git a/src/ray.c b/src/ray.c
index 9fb9023..7de5591 100644
--- a/src/ray.c
+++ b/src/ray.c
@@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "config.h"
#include <raylib.h>
#include <stdbool.h>